mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
storage: Fix a resource leak in storageVolCreateXML
Commit id '1b5685da' refactored the code to move buildvoldef inside the buildVol conditional; however, the VIR_FREE of the memory was left only when 'buildret' failed, thus we're leaking memory. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
6ab98a68b7
commit
27d2d99fe7
@ -1859,6 +1859,8 @@ storageVolCreateXML(virStoragePoolPtr obj,
|
||||
|
||||
buildret = backend->buildVol(obj->conn, pool, buildvoldef, flags);
|
||||
|
||||
VIR_FREE(buildvoldef);
|
||||
|
||||
storageDriverLock();
|
||||
virStoragePoolObjLock(pool);
|
||||
storageDriverUnlock();
|
||||
@ -1867,7 +1869,6 @@ storageVolCreateXML(virStoragePoolPtr obj,
|
||||
pool->asyncjobs--;
|
||||
|
||||
if (buildret < 0) {
|
||||
VIR_FREE(buildvoldef);
|
||||
storageVolDeleteInternal(volobj, backend, pool, voldef,
|
||||
0, false);
|
||||
voldef = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user