Re: [PATCH v2 09/32] conf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStoragePoolDef

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 08, 2019 at 01:37:03PM -0500, John Ferlan wrote:
Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
src/conf/domain_conf.c             |  3 +--
src/conf/storage_conf.c            |  3 +--
src/conf/storage_conf.h            |  1 +
src/conf/virstorageobj.c           | 27 +++++++++++----------------
src/phyp/phyp_driver.c             |  3 +--
src/storage/storage_driver.c       |  6 ++----
src/test/test_driver.c             |  6 ++----
tests/storagebackendsheepdogtest.c |  6 ++----
tests/storagepoolxml2xmltest.c     |  3 +--
tests/storagevolxml2argvtest.c     |  3 +--
tests/storagevolxml2xmltest.c      |  3 +--
11 files changed, 24 insertions(+), 40 deletions(-)

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index cac5642afd..dc082b1d08 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1952,11 +1952,11 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
{
    virCheckFlags(0, NULL);

-    virStoragePoolDefPtr spdef = NULL;
    virStorageVolPtr vol = NULL;
    virStorageVolPtr dup_vol = NULL;
    char *key = NULL;
    VIR_AUTOPTR(virStorageVolDef) voldef = NULL;
+    VIR_AUTOPTR(virStoragePoolDef) spdef = NULL;

    if (VIR_ALLOC(spdef) < 0)
        return NULL;
@@ -2036,7 +2036,6 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,

 err:
    VIR_FREE(key);
-    virStoragePoolDefFree(spdef);

It seems spdef was leaked on success in this function before this patch.

    virObjectUnref(vol);
    return NULL;
}

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux