]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
parallels: check and handle error for virAsprintf() calls
authorJohn Ferlan <jferlan@redhat.com>
Thu, 3 Jan 2013 19:16:14 +0000 (14:16 -0500)
committerEric Blake <eblake@redhat.com>
Thu, 3 Jan 2013 21:37:40 +0000 (14:37 -0700)
Ignore the return in parallelsMakePoolName() since subsequent check
validates name was allocated.

src/parallels/parallels_storage.c

index e768d881f825e8ba90d5e57895a16e7f42b13dc9..2908bee4f3f787c06c1b4469b23c98a897c2a438 100644 (file)
@@ -146,7 +146,7 @@ static char *parallelsMakePoolName(virConnectPtr conn, const char *path)
         if (i == 0)
             name = strdup(path);
         else
-            virAsprintf(&name, "%s-%u", path, i);
+            ignore_value(virAsprintf(&name, "%s-%u", path, i));
 
         if (!name) {
             virReportOOMError();
@@ -310,8 +310,7 @@ static int parallelsAddDiskVolume(virStoragePoolObjPtr pool,
     if (VIR_ALLOC(def))
         goto no_memory;
 
-    virAsprintf(&def->name, "%s-%s", dom->def->name, diskName);
-    if (!def->name)
+    if (virAsprintf(&def->name, "%s-%s", dom->def->name, diskName) < 0)
         goto no_memory;
 
     def->type = VIR_STORAGE_VOL_FILE;