mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-04 10:55:19 +00:00
qemu: avoid NULL deref on error
* src/qemu/qemu_command.c (qemuParseCommandLineDisk): Report error before cleaning def.
This commit is contained in:
parent
bd6ea30384
commit
0cca53921d
@ -4603,9 +4603,10 @@ qemuParseCommandLineDisk(virCapsPtr caps,
|
|||||||
host = def->src + strlen("nbd:");
|
host = def->src + strlen("nbd:");
|
||||||
port = strchr(host, ':');
|
port = strchr(host, ':');
|
||||||
if (!port) {
|
if (!port) {
|
||||||
def = NULL;
|
|
||||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("cannot parse nbd filename '%s'"), def->src);
|
_("cannot parse nbd filename '%s'"),
|
||||||
|
def->src);
|
||||||
|
def = NULL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
*port++ = '\0';
|
*port++ = '\0';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user