]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Add proper OOM reporting for esxDomainGetOSType
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 6 Aug 2009 13:07:46 +0000 (15:07 +0200)
committerDaniel Veillard <veillard@redhat.com>
Thu, 6 Aug 2009 13:07:46 +0000 (15:07 +0200)
* src/esx/esx_driver.c: catch an unchecked strdup in
  esxDomainGetOSType()

src/esx/esx_driver.c

index dba6305a986d95300017bf4ebe3904b11521eb0c..8b8575ce19f0da46318438781c57daa1c30bd529 100644 (file)
@@ -1395,9 +1395,16 @@ esxDomainDestroy(virDomainPtr domain)
 
 
 static char *
-esxDomainGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED)
+esxDomainGetOSType(virDomainPtr domain)
 {
-    return strdup("hvm");
+    char *osType = strdup("hvm");
+
+    if (osType == NULL) {
+        virReportOOMError(domain->conn);
+        return NULL;
+    }
+
+    return osType;
 }