[libvirt] [PATCH 02/10] Check and handle error for virAsprintf() calls. Ignore the return in parallelsMakePoolName() since subsequent check validates name was allocated.

John Ferlan jferlan at redhat.com
Thu Jan 3 19:16:14 UTC 2013


---
 src/parallels/parallels_storage.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c
index e768d88..2908bee 100644
--- a/src/parallels/parallels_storage.c
+++ b/src/parallels/parallels_storage.c
@@ -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;
-- 
1.7.11.7




More information about the libvir-list mailing list