提交 3dc42686 编写于 作者: J Jim Meyering

usbGetDevice: don't leak a "usbDevice" buffer on failure path

* src/util/hostusb.c (usbGetDevice): Free "dev" when returning NULL.
上级 9827e0a4
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册