Re: [PATCH 2/4] lxc: Allow NULL argument to lxcDomainDefNamespaceFree()

2020-12-16 Thread Laine Stump

On 12/16/20 4:12 PM, Michal Privoznik wrote:

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 




[PATCH 2/4] lxc: Allow NULL argument to lxcDomainDefNamespaceFree()

2020-12-16 Thread Michal Privoznik
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 
---
 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);
-- 
2.26.2