提交 27d2d99f 编写于 作者: J John Ferlan

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: NJohn Ferlan <jferlan@redhat.com>
上级 6ab98a68
...@@ -1859,6 +1859,8 @@ storageVolCreateXML(virStoragePoolPtr obj, ...@@ -1859,6 +1859,8 @@ storageVolCreateXML(virStoragePoolPtr obj,
buildret = backend->buildVol(obj->conn, pool, buildvoldef, flags); buildret = backend->buildVol(obj->conn, pool, buildvoldef, flags);
VIR_FREE(buildvoldef);
storageDriverLock(); storageDriverLock();
virStoragePoolObjLock(pool); virStoragePoolObjLock(pool);
storageDriverUnlock(); storageDriverUnlock();
...@@ -1867,7 +1869,6 @@ storageVolCreateXML(virStoragePoolPtr obj, ...@@ -1867,7 +1869,6 @@ storageVolCreateXML(virStoragePoolPtr obj,
pool->asyncjobs--; pool->asyncjobs--;
if (buildret < 0) { if (buildret < 0) {
VIR_FREE(buildvoldef);
storageVolDeleteInternal(volobj, backend, pool, voldef, storageVolDeleteInternal(volobj, backend, pool, voldef,
0, false); 0, false);
voldef = NULL; voldef = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册