qga: free remaining leaking state
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 15 Jul 2016 15:52:52 +0000 (17:52 +0200)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 8 Sep 2016 13:57:32 +0000 (17:57 +0400)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
qga/guest-agent-command-state.c
qga/guest-agent-core.h
qga/main.c

index 4de229cd787faf4f76ddc2ed9de7dc66bfaf8181..e609d320f0d2231cf2861bd2900b22e0efc099c5 100644 (file)
@@ -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);
+}
index 0a495160455433ee539f21521c31df1fe4798e1e..63e9d398ae5a7b25d3051e5055646358bcf3a3e6 100644 (file)
@@ -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);
index bb48214d18f530a4ebfb564202afa55ad7436565..0b9d04ea04f45115ca32fb97d3f5330a3ed88886 100644 (file)
@@ -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;
 }