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

[libvirt] [PATCH 01/10] parallels: Resolve Coverity USE_AFTER_FREE



Coverity complains that calling virNetworkDefFree(def), then jumping
to the cleanup: label which calls virNetworkDefFree(def) could result
in a double_free.  Just remove the call from the if statement.

Signed-off-by: John Ferlan <jferlan redhat com>
---
 src/parallels/parallels_network.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c
index a45acdc..f41c97f 100644
--- a/src/parallels/parallels_network.c
+++ b/src/parallels/parallels_network.c
@@ -226,10 +226,8 @@ parallelsLoadNetwork(parallelsConnPtr privconn, virJSONValuePtr jobj)
         goto cleanup;
     }
 
-    if (!(net = virNetworkAssignDef(&privconn->networks, def, false))) {
-        virNetworkDefFree(def);
+    if (!(net = virNetworkAssignDef(&privconn->networks, def, false)))
         goto cleanup;
-    }
     net->active = 1;
     net->autostart = 1;
     virNetworkObjUnlock(net);
-- 
1.9.3


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