[libvirt] [PATCH 02/10] conf: avoid freeing network object with undestroyed mutex

Eric Blake eblake at redhat.com
Mon Sep 17 21:50:39 UTC 2012


On 09/17/2012 03:48 AM, Laine Stump wrote:
> virNetworkAssignDef was allocating a new network object, initing and
> grabbing its lock, then potentially freeing it without unlocking or
> destroying the lock. In practice 1) this will probably never happen,
> and 2) even if it did, the lock implementation used on most (all?)

This is probably a safe claim for Unix-like systems, but mingw can be
rather surprising, and I think actually leaks resources in this scenario.

> platforms doesn't actually hold any resources for an initialized or
> held lock, but it still bothered me, so I moved the realloc that could
> lead to this bad situation earlier in the function, and now the mutex
> isn't inited or locked until we are assured of complete success.
> ---
>  src/conf/network_conf.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120917/bf34abfe/attachment-0001.sig>


More information about the libvir-list mailing list