From: Michal Privoznik Date: Thu, 21 Jun 2018 10:11:29 +0000 (+0200) Subject: virDomainSnapshotDefParse: Prefer VIR_STEAL_PTR X-Git-Tag: v4.5.0-rc1~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95cd4904e1bfa1d13e95c55a259129b5f349a70e;p=thirdparty%2Flibvirt.git virDomainSnapshotDefParse: Prefer VIR_STEAL_PTR Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 787c3d0feb..9c537ac7d1 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -331,8 +331,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, "disk-only snapshot")); goto cleanup; } - def->file = memoryFile; - memoryFile = NULL; + VIR_STEAL_PTR(def->file, memoryFile); /* verify that memory path is absolute */ if (def->file && def->file[0] != '/') { @@ -372,7 +371,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, if (!offline && virSaveCookieParse(ctxt, &def->cookie, saveCookie) < 0) goto cleanup; - ret = def; + VIR_STEAL_PTR(ret, def); cleanup: VIR_FREE(creation); @@ -380,8 +379,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, VIR_FREE(nodes); VIR_FREE(memorySnapshot); VIR_FREE(memoryFile); - if (ret == NULL) - virDomainSnapshotDefFree(def); + virDomainSnapshotDefFree(def); return ret; }