[libvirt PATCH 1/5] virNWFilterObjListFree: Prevent null pointer derefernce

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux