mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00: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:
parent
9827e0a42c
commit
3dc4268669
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user