From: Marc-André Lureau Date: Fri, 15 Jul 2016 15:52:52 +0000 (+0200) Subject: qga: free remaining leaking state X-Git-Tag: v2.8.0-rc0~154^2~21 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3e3e302ff388669d811077248aee45c45a14168e;p=qemu-xen-unstable.git qga: free remaining leaking state Signed-off-by: Marc-André Lureau Reviewed-by: Eric Blake --- diff --git a/qga/guest-agent-command-state.c b/qga/guest-agent-command-state.c index 4de229cd78..e609d320f0 100644 --- a/qga/guest-agent-command-state.c +++ b/qga/guest-agent-command-state.c @@ -71,3 +71,9 @@ GACommandState *ga_command_state_new(void) cs->groups = NULL; return cs; } + +void ga_command_state_free(GACommandState *cs) +{ + g_slist_free_full(cs->groups, g_free); + g_free(cs); +} diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h index 0a49516045..63e9d398ae 100644 --- a/qga/guest-agent-core.h +++ b/qga/guest-agent-core.h @@ -28,6 +28,7 @@ void ga_command_state_add(GACommandState *cs, void ga_command_state_init_all(GACommandState *cs); void ga_command_state_cleanup_all(GACommandState *cs); GACommandState *ga_command_state_new(void); +void ga_command_state_free(GACommandState *cs); bool ga_logging_enabled(GAState *s); void ga_disable_logging(GAState *s); void ga_enable_logging(GAState *s); diff --git a/qga/main.c b/qga/main.c index bb48214d18..0b9d04ea04 100644 --- a/qga/main.c +++ b/qga/main.c @@ -1371,6 +1371,8 @@ int main(int argc, char **argv) end: if (s->command_state) { ga_command_state_cleanup_all(s->command_state); + ga_command_state_free(s->command_state); + json_message_parser_destroy(&s->parser); } if (s->channel) { ga_channel_free(s->channel); @@ -1383,6 +1385,10 @@ end: } config_free(config); + if (s->main_loop) { + g_main_loop_unref(s->main_loop); + } + g_free(s); return ret; }