libxl_domain: Resolve Coverity RESOURCE_LEAK

On the error path need to free the chrdef
This commit is contained in:
John Ferlan 2014-08-27 14:47:43 -04:00
parent 6f8a4f6d65
commit 2cc03c8050

View File

@ -532,8 +532,10 @@ libxlDomainDefPostParse(virDomainDefPtr def,
chrdef->target.port = 0; chrdef->target.port = 0;
chrdef->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN; 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; return -1;
}
def->nconsoles = 1; def->nconsoles = 1;
def->consoles[0] = chrdef; def->consoles[0] = chrdef;