]> git.ipfire.org Git - thirdparty/libvirt.git/commit
storage: Fix error path in virStoragePoolObjLoad
authorJohn Ferlan <jferlan@redhat.com>
Thu, 25 Feb 2016 20:24:27 +0000 (15:24 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 26 Feb 2016 12:23:05 +0000 (07:23 -0500)
commitc53e4ae0c83d4e1962b63de413f229af77ff57cc
tree34f5852fa0f3c0eb4e4af0e581addc699c03d50e
parent07ba74858ba5176ca09bbfd1e092f906e9549544
storage: Fix error path in virStoragePoolObjLoad

While reviewing how storage driver used ObjListPtr's for reference
in some recent secret driver patches to use the same mechanism, I came
across an instance where the wrong API was called for error paths after
successfully allocating the storage pool pointer and inserting into
the driver pool list.

The path is after virStoragePoolObjAssignDef succeeds - the 'def' passed
in is assigned to pool->def (or newDef) so it shouldn't be the only thing
deleted. The pool is now part of driver->pools.objs, so it would need to
be removed (as happens in the storagePoolCreateXML error paths).

Rather than calling virStoragePoolDefFree to free the def which is now
assigned to the pool, call virStoragePoolObjRemove to ensure the pool
element is removed from the driver list and that anything stored in pool
is properly handled by virStoragePoolObjFree including the call to
virStoragePoolDefFree for the pool->{def|newDef} element.
src/conf/storage_conf.c