Skip to content

Commit

Permalink
qga: free remaining leaking state
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
  • Loading branch information
elmarco committed Sep 8, 2016
1 parent 2aa67a9 commit 3e3e302
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions qga/guest-agent-command-state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions qga/guest-agent-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions qga/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -1383,6 +1385,10 @@ int main(int argc, char **argv)
}

config_free(config);
if (s->main_loop) {
g_main_loop_unref(s->main_loop);
}
g_free(s);

return ret;
}

0 comments on commit 3e3e302

Please sign in to comment.