]> xenbits.xensource.com Git - libvirt.git/commitdiff
phyp: avoid a crash
authorEric Blake <eblake@redhat.com>
Thu, 12 May 2011 02:00:35 +0000 (20:00 -0600)
committerEric Blake <eblake@redhat.com>
Sat, 14 May 2011 15:24:27 +0000 (09:24 -0600)
This has been present since the introduction of phypAttachDevice
in commit 444fd07a.

* src/phyp/phyp_driver.c (phypAttachDevice): Don't dereference
NULL.

src/phyp/phyp_driver.c

index cc9ace3439af0dbda00982092e6a18fc15abe109..8b6fa69d930ac59ae90930deb6848f316c46a5fb 100644 (file)
@@ -1720,6 +1720,11 @@ phypAttachDevice(virDomainPtr domain, const char *xml)
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     char *domain_name = NULL;
 
+    if (VIR_ALLOC(def) < 0) {
+        virReportOOMError();
+        goto cleanup;
+    }
+
     domain_name = escape_specialcharacters(domain->name);
 
     if (domain_name == NULL) {