]> xenbits.xensource.com Git - libvirt.git/commitdiff
snapshot: simplify OOM checking during parse
authorEric Blake <eblake@redhat.com>
Thu, 25 Oct 2012 22:26:41 +0000 (16:26 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 2 Nov 2012 15:43:49 +0000 (09:43 -0600)
* src/conf/snapshot_conf.c (virDomainSnapshotDefParseString):
Simplify OOM reporting.

src/conf/snapshot_conf.c

index 16c844da1ce0402c7328f04ab9f8ef5d70903061..9d0ee0fe2f2d1daef5d86f925d4afbd3d0688365 100644 (file)
@@ -208,15 +208,11 @@ virDomainSnapshotDefParseString(const char *xmlStr,
             virReportError(VIR_ERR_XML_ERROR, "%s",
                            _("a redefined snapshot must have a name"));
             goto cleanup;
-        } else {
-            ignore_value(virAsprintf(&def->name, "%lld",
-                                     (long long)tv.tv_sec));
         }
-    }
-
-    if (def->name == NULL) {
-        virReportOOMError();
-        goto cleanup;
+        if (virAsprintf(&def->name, "%lld", (long long)tv.tv_sec) < 0) {
+            virReportOOMError();
+            goto cleanup;
+        }
     }
 
     def->description = virXPathString("string(./description)", ctxt);