From: Eric Blake Date: Tue, 15 Feb 2011 00:34:05 +0000 (-0700) Subject: qemu: avoid NULL deref on error X-Git-Tag: v0.8.8~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cca53921d133d51cb4f8f11ae85b1eac4f9b9da;p=thirdparty%2Flibvirt.git qemu: avoid NULL deref on error * src/qemu/qemu_command.c (qemuParseCommandLineDisk): Report error before cleaning def. --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3ba095049d..1687203245 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4603,9 +4603,10 @@ qemuParseCommandLineDisk(virCapsPtr caps, host = def->src + strlen("nbd:"); port = strchr(host, ':'); if (!port) { - def = NULL; qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse nbd filename '%s'"), def->src); + _("cannot parse nbd filename '%s'"), + def->src); + def = NULL; goto cleanup; } *port++ = '\0';