libqos: remove some leaks
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 18 Dec 2015 14:13:32 +0000 (15:13 +0100)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 2 Feb 2016 12:28:58 +0000 (13:28 +0100)
qpci_device_find() returns allocated data, don't leak it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
tests/libqos/pci.c

index 4e630c250a2d3769ff66fc1699a3525b668ff65e..80b1a2117d081a4bb8a8dca2cb35fa27d7382f93 100644 (file)
@@ -34,11 +34,13 @@ void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id,
 
             if (vendor_id != -1 &&
                 qpci_config_readw(dev, PCI_VENDOR_ID) != vendor_id) {
+                g_free(dev);
                 continue;
             }
 
             if (device_id != -1 &&
                 qpci_config_readw(dev, PCI_DEVICE_ID) != device_id) {
+                g_free(dev);
                 continue;
             }