From patchwork Thu Jul 28 14:37:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 653759 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s0ZVh2bQ0z9t1M for ; Fri, 29 Jul 2016 00:48:44 +1000 (AEST) Received: from localhost ([::1]:53720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSmc6-0000eR-2p for incoming@patchwork.ozlabs.org; Thu, 28 Jul 2016 10:48:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSmSC-0007Gi-QQ for qemu-devel@nongnu.org; Thu, 28 Jul 2016 10:38:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSmSB-0000dm-S6 for qemu-devel@nongnu.org; Thu, 28 Jul 2016 10:38:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSmSB-0000de-My for qemu-devel@nongnu.org; Thu, 28 Jul 2016 10:38:27 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E7D67F749 for ; Thu, 28 Jul 2016 14:38:27 +0000 (UTC) Received: from localhost (ovpn-116-92.phx2.redhat.com [10.3.116.92]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6SEcPtZ026566; Thu, 28 Jul 2016 10:38:26 -0400 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Thu, 28 Jul 2016 18:37:35 +0400 Message-Id: <20160728143808.13707-5-marcandre.lureau@redhat.com> In-Reply-To: <20160728143808.13707-1-marcandre.lureau@redhat.com> References: <20160728143808.13707-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 28 Jul 2016 14:38:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 04/37] qga: free remaining leaking state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- qga/guest-agent-command-state.c | 7 +++++++ qga/guest-agent-core.h | 1 + qga/main.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/qga/guest-agent-command-state.c b/qga/guest-agent-command-state.c index 4de229c..56e63b1 100644 --- a/qga/guest-agent-command-state.c +++ b/qga/guest-agent-command-state.c @@ -71,3 +71,10 @@ GACommandState *ga_command_state_new(void) cs->groups = NULL; return cs; } + +void ga_command_state_free(GACommandState *cs) +{ + g_slist_foreach(cs->groups, (GFunc)g_free, NULL); + g_slist_free(cs->groups); + g_free(cs); +} 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); diff --git a/qga/main.c b/qga/main.c index 67be90b..522a609 100644 --- a/qga/main.c +++ b/qga/main.c @@ -1372,6 +1372,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); @@ -1384,6 +1386,10 @@ end: } config_free(config); + if (s->main_loop) { + g_main_loop_unref(s->main_loop); + } + g_free(s); return ret; }