Allow virNWFilterObjListFree to be called with a NULL argument.
This enables a later patch to use virNWFilterObjListFree as a
cleanup function safely, as it is a no-op if virNWFilterObj was
not yet initialized.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/virnwfilterobj.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index e9bb2b1811..f9c1b049d5 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -110,6 +110,9 @@ virNWFilterObjFree(virNWFilterObj *obj)
void
virNWFilterObjListFree(virNWFilterObjList *nwfilters)
{
+ if (!nwfilters)
+ return;
+
g_hash_table_unref(nwfilters->objs);
g_hash_table_unref(nwfilters->objsName);
g_free(nwfilters);
--
2.31.1