From patchwork Wed May 5 09:22:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 12239473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F221C433ED for ; Wed, 5 May 2021 09:26:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 815EC6140F for ; Wed, 5 May 2021 09:26:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 815EC6140F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leDnE-0002oL-E6 for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 05:26:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leDkR-0000sr-FT for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:16 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:55252) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leDkL-000590-Cw for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:15 -0400 Received: by mail-wm1-x334.google.com with SMTP id o127so980599wmo.4 for ; Wed, 05 May 2021 02:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XOXXbFmKIzYlDZ6gGIuWNND3ouYEXltv7aZzivzNlxo=; b=lZQaQ31DtmHH3Nv+Tffdkue0yQmcHhmQkKipg0uXJqlrWKUHT8p5Yb01grtmWLYsi0 hfbrk6QDyG03MB8Oj77xXg2GwQS6RZzS6W6U0SAynHTx5kYiyvnh3xpZCuJgGBAtBYr8 7u266fmne/7hN43dvSuCWYgfUZ2qiQcR4kA09manT0YOt1RMVCBVA4O5rObqD4WuFOmi Dc+QzywvYbNqAnJC4sNd10dswGCALIZXprcSahVlxCl8BMFv2ghV+yddtLnh53D6FRZD yqmWFucqPrOD4jkY4vov2hU9DZbhSND2uiGnlTGxkGVfMVRskK0Sxlb9mmH9ESze1Th2 BX2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XOXXbFmKIzYlDZ6gGIuWNND3ouYEXltv7aZzivzNlxo=; b=d3mUjvk4mQd8XSmUJA3eUlYSnyYUCJNKrFzsmS0lXjAW6MaVZhObMSByAj2O1LZTSQ xh48KFf+xE+0ElwPrznVlzri9A5CRfWbNiAgoXUywDDatOUBydiQjNjpjivz63sIqssG G3n8le8NZKPCD/Yc81pPrhUogHeI7tg2xI3YTnULnVz6jGk7RMAOazUi+JYFm8WSR2We fK5clikmwU/1Jk+CNaZszaXRC4uvcG0PBG1bCPrIyA+lkFtfdlNeUXP3eX8estUyMXwJ PVS/8Faa09+TYy3daoWCPO8GCpLh/bq0AZJ8oaMCYB1ky/zTgUz4TgkNkMGOc0fk7q9X y2WQ== X-Gm-Message-State: AOAM5337p3PuT3N3OXsgIQ4lTGN/Tw81ictnYax739iIu9w6WQuWFVGc v96KhywZQc5ZeS+wqsJWx3ZzUQ== X-Google-Smtp-Source: ABdhPJx81BFahmoruKwtYyzySQ0OUECmYtdxRR7z4wHC2vvyDd9L/LZA0VY8VRmYTqk9o8qRLHrpjw== X-Received: by 2002:a7b:c24a:: with SMTP id b10mr8896908wmj.157.1620206587379; Wed, 05 May 2021 02:23:07 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o13sm4335362wmh.34.2021.05.05.02.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 02:23:00 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2B5D11FF90; Wed, 5 May 2021 10:23:00 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 4/7] plugins/hotpages: Properly freed the hash table values Date: Wed, 5 May 2021 10:22:56 +0100 Message-Id: <20210505092259.8202-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210505092259.8202-1-alex.bennee@linaro.org> References: <20210505092259.8202-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , minyihh@uci.edu, robhenry@microsoft.com, vilanova@imperial.ac.uk, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, mohamad.gebai@gmail.com, kuhn.chenqun@huawei.com, Mahmoud Mandour , matheus.ferst@eldorado.org.br Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mahmoud Mandour Allocated ``pages`` hash table through ``g_hash_table_new_full`` to add a freeing function & destroyed the hash table on exit. Signed-off-by: Mahmoud Mandour Signed-off-by: Alex Bennée Message-Id: <20210422005043.3569-3-ma.mandourr@gmail.com> --- contrib/plugins/hotpages.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/plugins/hotpages.c b/contrib/plugins/hotpages.c index bf53267532..9cf7f02c77 100644 --- a/contrib/plugins/hotpages.c +++ b/contrib/plugins/hotpages.c @@ -97,13 +97,14 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) g_list_free(it); } + g_hash_table_destroy(pages); qemu_plugin_outs(report->str); } static void plugin_init(void) { page_mask = (page_size - 1); - pages = g_hash_table_new(NULL, g_direct_equal); + pages = g_hash_table_new_full(NULL, g_direct_equal, NULL, g_free); } static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo,