diff options
Diffstat (limited to 'qga')
| -rw-r--r-- | qga/guest-agent-command-state.c | 6 | ||||
| -rw-r--r-- | qga/guest-agent-core.h | 1 | ||||
| -rw-r--r-- | qga/main.c | 13 |
3 files changed, 14 insertions, 6 deletions
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 4c3b2c772b..0b9d04ea04 100644 --- a/qga/main.c +++ b/qga/main.c @@ -1175,6 +1175,7 @@ static void config_free(GAConfig *config) #ifdef CONFIG_FSFREEZE g_free(config->fsfreeze_hook); #endif + g_list_free_full(config->blacklist, g_free); g_free(config); } @@ -1310,11 +1311,6 @@ static int run_agent(GAState *s, GAConfig *config) return EXIT_SUCCESS; } -static void free_blacklist_entry(gpointer entry, gpointer unused) -{ - g_free(entry); -} - int main(int argc, char **argv) { int ret = EXIT_SUCCESS; @@ -1375,11 +1371,12 @@ 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); } - g_list_foreach(config->blacklist, free_blacklist_entry, NULL); g_free(s->pstate_filepath); g_free(s->state_filepath_isfrozen); @@ -1388,6 +1385,10 @@ end: } config_free(config); + if (s->main_loop) { + g_main_loop_unref(s->main_loop); + } + g_free(s); return ret; } |