render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9119d9
From 7c2133b742b4cf7ecdf1c9fe16eeea439619baf3 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <7c2133b742b4cf7ecdf1c9fe16eeea439619baf3@dist-git>
9119d9
From: Laine Stump <laine@laine.org>
9119d9
Date: Mon, 15 Dec 2014 10:51:24 -0500
9119d9
Subject: [PATCH] conf: replace call to virNetworkFree() with virObjectUnref()
9119d9
9119d9
This is a prerequisite for the patches to fix:
9119d9
9119d9
  https://bugzilla.redhat.com/show_bug.cgi?id=1099210
9119d9
9119d9
The function virNetworkObjListExport() in network_conf.c had a call to
9119d9
the public API virNetworkFree() which was causing a link error:
9119d9
9119d9
CCLD     libvirt_driver_vbox_network_impl.la
9119d9
 ./.libs/libvirt_conf.a(libvirt_conf_la-network_conf.o): In function `virNetworkObjListExport':
9119d9
/home/laine/devel/libvirt/src/conf/network_conf.c:4496: undefined reference to `virNetworkFree'
9119d9
9119d9
This would happen when I added
9119d9
9119d9
  #include "network_conf.h"
9119d9
9119d9
into domain_conf.h, then attempted to call a new function from that
9119d9
file (and enum converter, similar to virNetworkForwardTypeToString())
9119d9
9119d9
In the end, virNetworkFree() ends up just calling virObjectUnref(obj)
9119d9
anyway (after clearing all pending errors, which we probably *don't*
9119d9
want to do in the cleanup of a utility function), so this is likely
9119d9
more correct than the original code as well.
9119d9
9119d9
(cherry picked from commit c2d5bca167ac12b0ae277edadd64bf90d7f4ed3c)
9119d9
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/conf/network_conf.c | 6 ++----
9119d9
 1 file changed, 2 insertions(+), 4 deletions(-)
9119d9
9119d9
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
9119d9
index 7b17d59..b253fec 100644
9119d9
--- a/src/conf/network_conf.c
9119d9
+++ b/src/conf/network_conf.c
9119d9
@@ -4480,10 +4480,8 @@ virNetworkObjListExport(virConnectPtr conn,
9119d9
 
9119d9
  cleanup:
9119d9
     if (tmp_nets) {
9119d9
-        for (i = 0; i < nnets; i++) {
9119d9
-            if (tmp_nets[i])
9119d9
-                virNetworkFree(tmp_nets[i]);
9119d9
-        }
9119d9
+        for (i = 0; i < nnets; i++)
9119d9
+            virObjectUnref(tmp_nets[i]);
9119d9
     }
9119d9
 
9119d9
     VIR_FREE(tmp_nets);
9119d9
-- 
9119d9
2.2.0
9119d9