Commit 448fe3c1 authored by Marc-André Lureau's avatar Marc-André Lureau
Browse files

tests: fix e1000e leaks



Spotted by ASAN.

This hunk adds an assertion. It checks that we're finding no more than
one e1000e device: each hit allocates, but there is only one g_free().

Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
parent 1bab33ab
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -99,7 +99,10 @@ static QPCIBus *test_bus;

static void e1000e_pci_foreach_callback(QPCIDevice *dev, int devfn, void *data)
{
    *(QPCIDevice **) data = dev;
    QPCIDevice **res = data;

    g_assert_null(*res);
    *res = dev;
}

static QPCIDevice *e1000e_device_find(QPCIBus *bus)
@@ -403,6 +406,7 @@ static void data_test_clear(e1000e_device *d)
    e1000e_device_clear(test_bus, d);
    close(test_sockets[0]);
    pc_alloc_uninit(test_alloc);
    g_free(d->pci_dev);
    qpci_free_pc(test_bus);
    qtest_end();
}