From: Jim Meyering Date: Mon, 25 Jan 2010 15:44:13 +0000 (+0100) Subject: usbGetDevice: don't leak a "usbDevice" buffer on failure path X-Git-Tag: v0.7.6~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3dc4268669cd1149539919c869ebbf769ab5fc35;p=thirdparty%2Flibvirt.git usbGetDevice: don't leak a "usbDevice" buffer on failure path * src/util/hostusb.c (usbGetDevice): Free "dev" when returning NULL. --- diff --git a/src/util/hostusb.c b/src/util/hostusb.c index 9a37103caf..f635ce5ebf 100644 --- a/src/util/hostusb.c +++ b/src/util/hostusb.c @@ -171,8 +171,10 @@ usbGetDevice(virConnectPtr conn, if (vendor) { /* Look up bus.dev by vendor:product */ - if (usbFindBusByVendor(conn, vendor, product, &bus, &devno) < 0) + if (usbFindBusByVendor(conn, vendor, product, &bus, &devno) < 0) { + VIR_FREE(dev); return NULL; + } } dev->bus = bus;