From: Eric Blake Date: Thu, 12 May 2011 02:00:35 +0000 (-0600) Subject: phyp: avoid a crash X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0f9e52da82fadfc848f081428856c504e55220b4;p=libvirt.git phyp: avoid a crash This has been present since the introduction of phypAttachDevice in commit 444fd07a. * src/phyp/phyp_driver.c (phypAttachDevice): Don't dereference NULL. --- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index cc9ace3439..8b6fa69d93 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -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) {