From: Peter Krempa Date: Mon, 18 Feb 2019 12:24:37 +0000 (+0100) Subject: util: Use virStorageSourceNew in virStorageFileMetadataNew X-Git-Tag: v5.1.0-rc1~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e5634ec79d489d2fbb83bf2e2cd3b1b437ce8e4;p=thirdparty%2Flibvirt.git util: Use virStorageSourceNew in virStorageFileMetadataNew Commit dcda2bf4c110 forgot to fix this one instance. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 5927140a66..b2e308d81d 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1119,22 +1119,20 @@ static virStorageSourcePtr virStorageFileMetadataNew(const char *path, int format) { - virStorageSourcePtr def = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; + virStorageSourcePtr ret = NULL; - if (VIR_ALLOC(def) < 0) + if (!(def = virStorageSourceNew())) return NULL; def->format = format; def->type = VIR_STORAGE_TYPE_FILE; if (VIR_STRDUP(def->path, path) < 0) - goto error; - - return def; + return NULL; - error: - virObjectUnref(def); - return NULL; + VIR_STEAL_PTR(ret, def); + return ret; }