From: Michal Privoznik Date: Wed, 18 Dec 2019 06:40:17 +0000 (+0100) Subject: virCapabilitiesHostNUMAUnref: Accept NULL X-Git-Tag: v6.0.0-rc1~212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=599f9c73d45369e2087be8ead53df8710d0f88dd;p=thirdparty%2Flibvirt.git virCapabilitiesHostNUMAUnref: Accept NULL Fortunately, this is not causing any problems now because glib does this check for us when calling this function via attribute cleanup. But in a future commit we will explicitly call this function over a struct member that might be NULL. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 4fac59e6f7..a782d92956 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -184,6 +184,9 @@ virCapabilitiesFreeStoragePool(virCapsStoragePoolPtr pool) void virCapabilitiesHostNUMAUnref(virCapsHostNUMAPtr caps) { + if (!caps) + return; + if (g_atomic_int_dec_and_test(&caps->refs)) { g_ptr_array_unref(caps->cells);