Received: from eggs.gnu.org ([2001:4830:134:3::10]:57266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi096-0000BH-Et for qemu-devel@nongnu.org; Thu, 08 Sep 2016 10:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi094-0000PF-Hk for qemu-devel@nongnu.org; Thu, 08 Sep 2016 10:17:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi094-0000P8-Bq for qemu-devel@nongnu.org; Thu, 08 Sep 2016 10:17:38 -0400 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 8 Sep 2016 18:16:59 +0400 Message-Id: <20160908141720.30641-5-marcandre.lureau@redhat.com> In-Reply-To: <20160908141720.30641-1-marcandre.lureau@redhat.com> References: <20160908141720.30641-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULLv2 04/25] qga: free remaining leaking state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, eblake@redhat.com, armbru@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Eric Blake --- qga/guest-agent-command-state.c | 6 ++++++ qga/main.c | 6 ++++++ qga/guest-agent-core.h | 1 + 3 files changed, 13 insertions(+) diff --git a/qga/guest-agent-command-state.c b/qga/guest-agent-command-st= ate.c index 4de229c..e609d32 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 =3D 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/main.c b/qga/main.c index bb48214..0b9d04e 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: } =20 config_free(config); + if (s->main_loop) { + g_main_loop_unref(s->main_loop); + } + g_free(s); =20 return ret; } diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h index 0a49516..63e9d39 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); --=20 2.10.0