From: John Snow Date: Mon, 4 Aug 2014 21:11:23 +0000 (-0400) Subject: libqos: Fixes a small memory leak. X-Git-Tag: qemu-xen-4.6.0-rc1~260^2~33 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7f2a5ae6c1194b1676f1a7239fbcacd9d59637be;p=qemu-upstream-4.6-testing.git libqos: Fixes a small memory leak. Allow users the chance to clean up the QPCIBusPC structure by adding a small cleanup routine. Helps clear up small memory leaks during setup/teardown, to allow for cleaner debug output messages. Signed-off-by: John Snow Signed-off-by: Stefan Hajnoczi --- diff --git a/tests/libqos/pci-pc.c b/tests/libqos/pci-pc.c index 4adf4006a..f5d646984 100644 --- a/tests/libqos/pci-pc.c +++ b/tests/libqos/pci-pc.c @@ -237,3 +237,10 @@ QPCIBus *qpci_init_pc(void) return &ret->bus; } + +void qpci_free_pc(QPCIBus *bus) +{ + QPCIBusPC *s = container_of(bus, QPCIBusPC, bus); + + g_free(s); +} diff --git a/tests/libqos/pci-pc.h b/tests/libqos/pci-pc.h index 4f7475f6f..26211790c 100644 --- a/tests/libqos/pci-pc.h +++ b/tests/libqos/pci-pc.h @@ -16,5 +16,6 @@ #include "libqos/pci.h" QPCIBus *qpci_init_pc(void); +void qpci_free_pc(QPCIBus *bus); #endif