From patchwork Tue Sep 6 12:26:17 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: 9316559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 93822601C0 for ; Tue, 6 Sep 2016 12:27:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8336328D0E for ; Tue, 6 Sep 2016 12:27:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 780B628D10; Tue, 6 Sep 2016 12:27:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 202C928D0E for ; Tue, 6 Sep 2016 12:27:49 +0000 (UTC) Received: from localhost ([::1]:33025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhFTg-0002cZ-5t for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Sep 2016 08:27:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhFSy-0002V2-Q2 for qemu-devel@nongnu.org; Tue, 06 Sep 2016 08:27:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhFSq-00015U-7h for qemu-devel@nongnu.org; Tue, 06 Sep 2016 08:27:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhFSq-00015M-2M for qemu-devel@nongnu.org; Tue, 06 Sep 2016 08:26:56 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 A009781F01; Tue, 6 Sep 2016 12:26:55 +0000 (UTC) Received: from localhost (ovpn-116-72.phx2.redhat.com [10.3.116.72]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u86CQrTf002486; Tue, 6 Sep 2016 08:26:54 -0400 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 6 Sep 2016 16:26:17 +0400 Message-Id: <20160906122639.11163-5-marcandre.lureau@redhat.com> In-Reply-To: <20160906122639.11163-1-marcandre.lureau@redhat.com> References: <20160906122639.11163-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 06 Sep 2016 12:26:55 +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] [PULL 04/26] 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: peter.maydell@linaro.org, armbru@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Marc-André 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-state.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 = 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: } config_free(config); + if (s->main_loop) { + g_main_loop_unref(s->main_loop); + } + g_free(s); 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);