From 8a7d552cb3684570491a5ecaa8b78818404ed2fb Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Fri, 9 Sep 2011 14:30:39 +0530 Subject: balloon: Disassociate handlers from balloon device on unplug When a balloon device gets unplugged, allow the balloon handlers to be freed. Reported-by: Shaolong Hu Signed-off-by: Amit Shah Signed-off-by: Amit Shah Signed-off-by: Anthony Liguori --- balloon.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'balloon.c') diff --git a/balloon.c b/balloon.c index f56fdc1c4b..a2133dba75 100644 --- a/balloon.c +++ b/balloon.c @@ -52,6 +52,16 @@ int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, return 0; } +void qemu_remove_balloon_handler(void *opaque) +{ + if (balloon_opaque != opaque) { + return; + } + balloon_event_fn = NULL; + balloon_stat_fn = NULL; + balloon_opaque = NULL; +} + static int qemu_balloon(ram_addr_t target) { if (!balloon_event_fn) { -- cgit v1.2.1