From 9649b0a8b412220bd7696e0f200ab4c435302c18 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 31 Jul 2012 08:05:14 -0600 Subject: [PATCH] qemu: fix use after free Detected by Coverity. * src/qemu/qemu_hotplug.c (qemuDomainAttachHostDevice): Avoid double free of usb on failure. (cherry picked from commit 665c8cdecc2d91a83f08a6ec95531b0de57c0e0a) --- src/qemu/qemu_hotplug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 62de67c9f9..fcc7c0ff7d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1170,6 +1170,7 @@ int qemuDomainAttachHostDevice(struct qemud_driver *driver, if (usbDeviceListAdd(list, usb) < 0) { usbFreeDevice(usb); + usb = NULL: goto cleanup; }