[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu_driver.c: avoid double free on error path



Note that there's nearly identical code in the same file where
there is already an "event = NULL;" statement right after
two identical lines.

>From 69f3c74b6cdc36fb4958f4c9cc2d4497a03d40c1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Mon, 14 Dec 2009 15:55:19 +0100
Subject: [PATCH] qemu_driver.c: avoid double free on error path

* src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Set
"event" to NULL after qemuDomainEventQueue frees it, so a
subsequent free (after endjob label) upon qemuMonitorStartCPUs
failure does not cause a double free.
---
 src/qemu/qemu_driver.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 34fa582..43f7927 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7668,6 +7668,7 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
                                              VIR_DOMAIN_EVENT_DEFINED_UPDATED);
             if (event)
                 qemuDomainEventQueue(driver, event);
+            event = NULL;

         }
         qemuDomainObjPrivatePtr priv = vm->privateData;
--
1.6.6.rc2.275.g51e2d


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]