mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 05:25:18 +00:00
libxl_domain: Resolve Coverity RESOURCE_LEAK
On the error path need to free the chrdef
This commit is contained in:
parent
6f8a4f6d65
commit
2cc03c8050
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user