]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
conf: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 10 Mar 2014 12:45:10 +0000 (13:45 +0100)
commit2133441a07194a49d5e7e8249929ab31c4d7a14e
tree9167444365a9404ab3d64c6346f1688c08c8b9a8
parent925de19ed7f13e0d12d0b993496d314bab886589
conf: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

This fixes a possible double free. In virNetworkAssignDef() if
virBitmapNew() fails, then virNetworkObjFree(network) is called.
However, with network->def pointing to actual @def. So if caller
frees @def again, ...

Moreover, this fixes one possible memory leak too. In
virInterfaceAssignDef() if appending to the list of interfaces
fails, we ought to call virInterfaceObjFree() instead of bare
VIR_FREE().

Although, in order to do that some array size variables needs
to be turned into size_t rather than int.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
15 files changed:
src/conf/domain_conf.c
src/conf/domain_conf.h
src/conf/interface_conf.c
src/conf/interface_conf.h
src/conf/network_conf.c
src/conf/network_conf.h
src/conf/node_device_conf.c
src/conf/node_device_conf.h
src/conf/nwfilter_conf.c
src/conf/nwfilter_conf.h
src/conf/nwfilter_params.c
src/conf/nwfilter_params.h
src/conf/object_event.c
src/conf/storage_conf.c
src/qemu/qemu_driver.c