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

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



---
 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


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