]> git.ipfire.org Git - thirdparty/libvirt.git/commit
storage: Fix a potential crash when creating vol object
authorOsier Yang <jyang@redhat.com>
Mon, 12 Dec 2011 07:26:20 +0000 (15:26 +0800)
committerOsier Yang <jyang@redhat.com>
Tue, 13 Dec 2011 03:14:26 +0000 (11:14 +0800)
commit380f326955a25f84dca45b4eead2a7aa4d11e6f2
tree9aa3da73a7157bbace10bc4b1ad72a98e82052ea
parentfe7fc1617c7adbc62dee87954480e500fb4873c0
storage: Fix a potential crash when creating vol object

If the vol object is newly created, it increases the volumes count,
but doesn't decrease the volumes count when do cleanup. It can
cause libvirtd to crash when one trying to free the volume objects
like:
    for (i = 0; i < pool->volumes.count; i++)
        virStorageVolDefFree(pool->volumes.objs[i]);

It's more reliable if we add the newly created vol object in the
end.
src/storage/storage_backend_logical.c