From 62efeb07523cb6f3f4ec8ae742a81e7a86466546 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 6 Jul 2007 21:52:42 +0000 Subject: [PATCH] Fixed memory corruption after destroying network/domain objects in QEMU driver --- ChangeLog | 6 ++++++ src/qemu_driver.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a44d65caee..03f30084e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Jul 6 17:50:00 EST 2007 Daniel P.Berrange + + * src/qemu_driver.c: Use virFreeDomain and virFreeNetwork + instead of free(), to ensure the objects are removed from + the cache + Fri Jul 6 16:19:00 BST 2007 Richard W.M. Jones * src/libvirt.c, src/qemu_driver.c: If the virNetworkLookup* diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 0f233eaba1..f6d24a480b 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -1903,7 +1903,7 @@ static int qemudDomainDestroy(virDomainPtr dom) { } ret = qemudShutdownVMDaemon(driver, vm); - free(dom); + virFreeDomain(dom->conn, dom); return ret; } @@ -2332,6 +2332,7 @@ static int qemudNetworkStart(virNetworkPtr net) { static int qemudNetworkDestroy(virNetworkPtr net) { struct qemud_driver *driver = (struct qemud_driver *)net->conn->networkPrivateData; struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid); + int ret; if (!network) { qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, @@ -2339,7 +2340,11 @@ static int qemudNetworkDestroy(virNetworkPtr net) { return -1; } - return qemudShutdownNetworkDaemon(driver, network); + ret = qemudShutdownNetworkDaemon(driver, network); + + virFreeNetwork(net->conn, net); + + return ret; } static char *qemudNetworkDumpXML(virNetworkPtr net, int flags ATTRIBUTE_UNUSED) { -- GitLab