From 6ac44c6334381d6fb1aac55c98ac95684f545af6 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 15 Dec 2020 20:04:58 +0100 Subject: [PATCH] lxc: Allow NULL argument to lxcDomainDefNamespaceFree() 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 Reviewed-by: Laine Stump --- src/lxc/lxc_domain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index df60519fca..707262336b 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -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);