From: Michal Privoznik <[email protected]> In the virDomainCaps struct there are some pointers that might be NULL (for instance 'sev', 'sgx', 'hyperv'). Teach FORMAT_PROLOGUE macro to check for NULL argument so that format functions (like virDomainCapsFeatureHypervFormat()) don't need to.
Signed-off-by: Michal Privoznik <[email protected]> --- src/conf/domain_capabilities.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 1c69a05685..78a5b1f56a 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -375,7 +375,7 @@ virDomainCapsStringValuesFormat(virBuffer *buf, #define FORMAT_PROLOGUE(item) \ do { \ - if (item->supported == VIR_TRISTATE_BOOL_ABSENT) \ + if (!item || item->supported == VIR_TRISTATE_BOOL_ABSENT) \ return; \ virBufferAsprintf(buf, "<" #item " supported='%s'%s\n", \ (item->supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no", \ @@ -818,9 +818,6 @@ virDomainCapsFeatureHypervFormat(virBuffer *buf, { virBuffer defaults = VIR_BUFFER_INIT_CHILD(buf); - if (!hyperv) - return; - FORMAT_PROLOGUE(hyperv); ENUM_PROCESS(hyperv, features, virDomainHypervTypeToString); -- 2.51.0
