mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
usbGetDevice: don't leak a "usbDevice" buffer on failure path
* src/util/hostusb.c (usbGetDevice): Free "dev" when returning NULL.
This commit is contained in:
+3
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user