mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
Fix crash on OOM in xenParseXM handling consoles
The xenParseXM sets def->nconsoles to 1 before claling VIR_REALLOC_N on def->consoles. So if the alloc fails due to OOM, the cleanup code will crash accessing a console that does not exist. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
fa911ec44e
commit
10b7d19fdd
@ -1112,9 +1112,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
def->nconsoles = 1;
|
||||
if (VIR_ALLOC_N(def->consoles, 1) < 0)
|
||||
goto cleanup;
|
||||
def->nconsoles = 1;
|
||||
if (!(def->consoles[0] = xenParseSxprChar("pty", NULL)))
|
||||
goto cleanup;
|
||||
def->consoles[0]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user