]> xenbits.xensource.com Git - libvirt.git/commitdiff
Adapt to VIR_ALLOC and virAsprintf in src/vmware/*
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Jul 2013 10:17:55 +0000 (12:17 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Jul 2013 09:07:33 +0000 (11:07 +0200)
src/vmware/vmware_conf.c
src/vmware/vmware_driver.c

index 9d3d37ee0f5a8c463a4f3529fbb6d351b8f3c774..b6d20ea1484f22fab970419d66681d5575ae73a6 100644 (file)
@@ -77,10 +77,8 @@ vmwareCapsInit(void)
                                       NULL, NULL, 0, NULL) == NULL)
         goto error;
 
-    if (VIR_ALLOC(cpu) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(cpu) < 0)
         goto error;
-    }
 
     if (!(cpu->arch = caps->host.arch)) {
         virReportOOMError();
@@ -315,18 +313,9 @@ error:
 int
 vmwareConstructVmxPath(char *directoryName, char *name, char **vmxPath)
 {
-    if (directoryName != NULL) {
-        if (virAsprintf(vmxPath, "%s/%s.vmx", directoryName, name) < 0) {
-            virReportOOMError();
-            return -1;
-        }
-    } else {
-        if (virAsprintf(vmxPath, "%s.vmx", name) < 0) {
-            virReportOOMError();
-            return -1;
-        }
-    }
-    return 0;
+    if (directoryName != NULL)
+        return virAsprintf(vmxPath, "%s/%s.vmx", directoryName, name);
+    return virAsprintf(vmxPath, "%s.vmx", name);
 }
 
 int
@@ -385,10 +374,8 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath)
         goto cleanup;
     }
 
-    if (vmwareConstructVmxPath(directoryName, vmdef->name, vmxPath) < 0) {
-        virReportOOMError();
+    if (vmwareConstructVmxPath(directoryName, vmdef->name, vmxPath) < 0)
         goto cleanup;
-    }
 
     ret = 0;
 
@@ -427,11 +414,7 @@ vmwareMoveFile(char *srcFile, char *dstFile)
 int
 vmwareMakePath(char *srcDir, char *srcName, char *srcExt, char **outpath)
 {
-    if (virAsprintf(outpath, "%s/%s.%s", srcDir, srcName, srcExt) < 0) {
-        virReportOOMError();
-        return -1;
-    }
-    return 0;
+    return virAsprintf(outpath, "%s/%s.%s", srcDir, srcName, srcExt);
 }
 
 int
@@ -448,10 +431,8 @@ vmwareExtractPid(const char * vmxPath)
         goto cleanup;
 
     if (virAsprintf(&logFilePath, "%s/vmware.log",
-                    vmxDir) < 0) {
-        virReportOOMError();
+                    vmxDir) < 0)
         goto cleanup;
-    }
 
     if ((logFile = fopen(logFilePath, "r")) == NULL)
         goto cleanup;
index ca6615fa01e0bd3b8711e472f62669d8c8f6622a..988552fcb439ab057762c32f999ddc3682fd462c 100644 (file)
@@ -126,10 +126,8 @@ vmwareConnectOpen(virConnectPtr conn,
         VIR_FREE(vmrun);
     }
 
-    if (VIR_ALLOC(driver) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(driver) < 0)
         return VIR_DRV_OPEN_ERROR;
-    }
 
     if (virMutexInit(&driver->lock) < 0)
         goto cleanup;