]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Adapt to VIR_ALLOC and virAsprintf in src/hyperv/*
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Jul 2013 10:09:29 +0000 (12:09 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Jul 2013 09:07:31 +0000 (11:07 +0200)
src/hyperv/hyperv_driver.c
src/hyperv/hyperv_util.c
src/hyperv/hyperv_wmi.c

index dd8d0184758c37736bcfaab3bb5f12b77384eced..389a151eb8456009c37438f2431c34e19afc13a8 100644 (file)
@@ -117,10 +117,8 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags
     }
 
     /* Allocate per-connection private data */
-    if (VIR_ALLOC(priv) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(priv) < 0)
         goto cleanup;
-    }
 
     if (hypervParseUri(&priv->parsedUri, conn->uri) < 0) {
         goto cleanup;
@@ -802,10 +800,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
 
     /* Flags checked by virDomainDefFormat */
 
-    if (VIR_ALLOC(def) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(def) < 0)
         goto cleanup;
-    }
 
     virUUIDFormat(domain->uuid, uuid_string);
 
@@ -1255,9 +1251,8 @@ hypervConnectListAllDomains(virConnectPtr conn,
          !MATCH(VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)) ||
         (MATCH(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT) &&
          !MATCH(VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT))) {
-        if (domains &&
-            VIR_ALLOC_N(*domains, 1) < 0)
-            goto no_memory;
+        if (domains && VIR_ALLOC_N(*domains, 1) < 0)
+            goto cleanup;
 
         ret = 0;
         goto cleanup;
@@ -1287,7 +1282,7 @@ hypervConnectListAllDomains(virConnectPtr conn,
 
     if (domains) {
         if (VIR_ALLOC_N(doms, 1) < 0)
-            goto no_memory;
+            goto cleanup;
         ndoms = 1;
     }
 
@@ -1326,7 +1321,7 @@ hypervConnectListAllDomains(virConnectPtr conn,
         }
 
         if (VIR_RESIZE_N(doms, ndoms, count, 2) < 0)
-            goto no_memory;
+            goto cleanup;
 
         domain = NULL;
 
@@ -1354,10 +1349,6 @@ cleanup:
     hypervFreeObject(priv, (hypervObject *)computerSystemList);
 
     return ret;
-
-no_memory:
-    virReportOOMError();
-    goto cleanup;
 }
 #undef MATCH
 
index b7c2a17ad624580db666060fc148154eb667e250..53c053001e5a38e69b6805e6aafdec75917497fd 100644 (file)
@@ -46,10 +46,8 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
         return -1;
     }
 
-    if (VIR_ALLOC(*parsedUri) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(*parsedUri) < 0)
         return -1;
-    }
 
     for (i = 0; i < uri->paramsCount; i++) {
         virURIParamPtr queryParam = &uri->params[i];
index 65fc83dcfe60ccdf15ce7d0f9c638dde38e7b5a5..39eed0c936820eb41d48461950bbf046272c1b84 100644 (file)
@@ -210,10 +210,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
             goto cleanup;
         }
 
-        if (VIR_ALLOC(object) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(object) < 0)
             goto cleanup;
-        }
 
         object->serializerInfo = serializerInfo;
         object->data = data;
@@ -414,10 +412,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
 
     if (virAsprintf(&selector, "Name=%s&CreationClassName=Msvm_ComputerSystem",
                     uuid_string) < 0 ||
-        virAsprintf(&properties, "RequestedState=%d", requestedState) < 0) {
-        virReportOOMError();
+        virAsprintf(&properties, "RequestedState=%d", requestedState) < 0)
         goto cleanup;
-    }
 
     options = wsmc_options_init();