提交 c2d5bca1 编写于 作者: L Laine Stump

conf: replace call to virNetworkFree() with virObjectUnref()

The function virNetworkObjListExport() in network_conf.c had a call to
the public API virNetworkFree() which was causing a link error:

CCLD     libvirt_driver_vbox_network_impl.la
 ./.libs/libvirt_conf.a(libvirt_conf_la-network_conf.o): In function `virNetworkObjListExport':
/home/laine/devel/libvirt/src/conf/network_conf.c:4496: undefined reference to `virNetworkFree'

This would happen when I added

  #include "network_conf.h"

into domain_conf.h, then attempted to call a new function from that
file (and enum converter, similar to virNetworkForwardTypeToString())

In the end, virNetworkFree() ends up just calling virObjectUnref(obj)
anyway (after clearing all pending errors, which we probably *don't*
want to do in the cleanup of a utility function), so this is likely
more correct than the original code as well.
上级 b79d195b
...@@ -4463,10 +4463,8 @@ virNetworkObjListExport(virConnectPtr conn, ...@@ -4463,10 +4463,8 @@ virNetworkObjListExport(virConnectPtr conn,
cleanup: cleanup:
if (tmp_nets) { if (tmp_nets) {
for (i = 0; i < nnets; i++) { for (i = 0; i < nnets; i++)
if (tmp_nets[i]) virObjectUnref(tmp_nets[i]);
virNetworkFree(tmp_nets[i]);
}
} }
VIR_FREE(tmp_nets); VIR_FREE(tmp_nets);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册