From: John Ferlan Date: Wed, 27 Aug 2014 18:47:43 +0000 (-0400) Subject: libxl_domain: Resolve Coverity RESOURCE_LEAK X-Git-Tag: v1.2.8-rc2~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cc03c80504469827a5552612b4a9375b7f14775;p=thirdparty%2Flibvirt.git libxl_domain: Resolve Coverity RESOURCE_LEAK On the error path need to free the chrdef --- diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index cdac82cd03..557fc20f9a 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -532,8 +532,10 @@ libxlDomainDefPostParse(virDomainDefPtr def, chrdef->target.port = 0; chrdef->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN; - if (VIR_ALLOC_N(def->consoles, 1) < 0) + if (VIR_ALLOC_N(def->consoles, 1) < 0) { + virDomainChrDefFree(chrdef); return -1; + } def->nconsoles = 1; def->consoles[0] = chrdef;