[libvirt] [PATCH] network: Resolve Coverity FORWARD_NULL

John Ferlan jferlan at redhat.com
Fri Jan 16 11:58:56 UTC 2015


Commit id 'ca481a6f' added virNetworkRouteDefFree which may be called
in an error path from lxcAddNetworkRouteDefinition with 'route = NULL'.
So just add the (!def) at the top to resolve.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/conf/networkcommon_conf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/conf/networkcommon_conf.c b/src/conf/networkcommon_conf.c
index 3f0896d..7b7a851 100644
--- a/src/conf/networkcommon_conf.c
+++ b/src/conf/networkcommon_conf.c
@@ -52,6 +52,8 @@ struct _virNetworkRouteDef {
 void
 virNetworkRouteDefFree(virNetworkRouteDefPtr def)
 {
+    if (!def)
+        return;
     VIR_FREE(def->family);
     VIR_FREE(def);
 }
-- 
2.1.0




More information about the libvir-list mailing list