]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc: Allow NULL argument to lxcDomainDefNamespaceFree()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 15 Dec 2020 19:04:58 +0000 (20:04 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 17 Dec 2020 08:42:08 +0000 (09:42 +0100)
As all other free functions, NULL should be accepted. Even though
there currently is no caller that would pass NULL, there will be
in future patches.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/lxc/lxc_domain.c

index df60519fca25b245339abb819281510094d3864c..707262336bed81db2778f4a1a32112ba8c9e50be 100644 (file)
@@ -195,6 +195,10 @@ lxcDomainDefNamespaceFree(void *nsdata)
 {
     size_t i;
     lxcDomainDefPtr lxcDef = nsdata;
+
+    if (!lxcDef)
+        return;
+
     for (i = 0; i < VIR_LXC_DOMAIN_NAMESPACE_LAST; i++)
         g_free(lxcDef->ns_val[i]);
     g_free(nsdata);