From patchwork Mon May 17 16:10:22 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: 440170 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1263730jac; Mon, 17 May 2021 09:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8pn2o+5UeTS7Uh6f+gYexLIkkfnXfgjzVZ2TNl8qzDWyHvepxckrRlj2pxHXkoMMylpQ+ X-Received: by 2002:a9d:748d:: with SMTP id t13mr437203otk.296.1621270561348; Mon, 17 May 2021 09:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621270561; cv=none; d=google.com; s=arc-20160816; b=dFpKpBIoaCx/V5JEAhQc9QYxKLmlvuJ6TOyMA1+bdgmzoyWbBXWmxMnGVoO7ix5enO 8hjvT/xbR7WQpeoRB1s3UKEnCh1Y78bHhxDNFwGKfXQiXD1+AO61zSOlVZw9F3JxaqTd mmTW3Wu7usyfsc4BRYQ3k0tmdeXrnvs70EszxvgeDF92WnVJFl6s2XeLMatSjbmTYmKL mtkd3loT/VbQzT9hmxQRr6xyakm0cU8WDT4vevOFtxPX/ApR2bUXUpdwMcRxqUGJhOdg p9AxybAw27Lm9UpPG56QcKKw3RGIbJVRXCUj8Il0CqSI2mD5KPp4HjU8KLgiUDEslx8M ICqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=aZuDUoz3vNGYexV1AEzGlzVlTs4kTeswm8li9GZxIko=; b=ZnVZDcakxi7160JvmvolRgWO0Ea/Mn2oFo9Vnpu7h9QijYlY8OZjCGFrRKEO+12Amn Bcf/LCdmv7GzkRvz6Dfa5sjfWbYdP5YtgwkQ3gUwI92qWFL2groc0r1Hgxflrj7eCb2H 9AKipfCg2Ur5eBeT91lj5xbsT8tZS9XS6M9ptNJRhJgqKhcnpXckXhbp20Gtwajcm7z8 dNc07UroQGyJqseRgaXhJXgL7vHaDRlgu3WXIpyS1c+jOMgqNj8gaHEcGE4Rph8P6Xds oMOsolL5omxtzzpG2d/OQPCjCoonYhOOez5O6mbK/cJuvu0SpceoKjBQxclPSXWgJjfm wW/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JV7tltDS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w28si14789188oti.83.2021.05.17.09.56.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 09:56:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JV7tltDS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ligXA-00028A-Qk for patch@linaro.org; Mon, 17 May 2021 12:56:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lifyr-0001om-3M for qemu-devel@nongnu.org; Mon, 17 May 2021 12:20:33 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:42596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lifyi-0002DT-RN for qemu-devel@nongnu.org; Mon, 17 May 2021 12:20:32 -0400 Received: by mail-wm1-x32b.google.com with SMTP id f75-20020a1c1f4e0000b0290171001e7329so3952654wmf.1 for ; Mon, 17 May 2021 09:20:23 -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=aZuDUoz3vNGYexV1AEzGlzVlTs4kTeswm8li9GZxIko=; b=JV7tltDSdSR9KmszjToHv6VBlamZSzMvBvKcaPronfV5LOmDnZVCqwlytyO+ha9CTb Bp9U1AQtHl6gT4CusHJp0A6lsy2w0TpNhDQJpgA92L/Md202XA7AT2GaiMPwV1ILJ1eR 5+DtnWDNuDE4lLDRiIHAc/MzF/cwl3WuaJEpnvPovanYvGLzAfLseIcTwfVT9kIw77kk neq00oaA9dMzGG9xraxEGlrKBs5L9vr/n4P5Gam8krGIrKur7sViX3BxiutL6V9jGOBW 50/5yGUwAvP1KZEbf3tGNSFiQt5XGmeuO8uuY92R/h64MLd/M7d3/mY97br4Km4HJTX6 VGuQ== 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=aZuDUoz3vNGYexV1AEzGlzVlTs4kTeswm8li9GZxIko=; b=gpYRa/wwC+/ZuCu0zFa21rMuFMZwYgWCkDTc7WOszv/sFOoz40/ofErXSbFNzGA7BM VloQ3bL0sG8VhO56fy5gMhHNwnFYQghEBfDU/Gq4+FVDpi8rv00RWmlH4csaRqPq9VOF VJGJD+gnM76ruJC/IwfxN/7+lebOZVtv1EJuIgGwJS45KEdOlUNcE+W8YUjllfgVvTR3 7C0WCgfrtc41Oqi2dBLb68E85FcWXkMIoKypjGHgBSJKDXRPBU49qZc+jsCgk0tNnCVe 2yMBJSB8FJbNp4hTDtIChVnqyN+HgDpTHMIO0dHvX5whz+Ai1xM3TJsYS+M0zMamS6Hy dRCQ== X-Gm-Message-State: AOAM530QUoVL1+xzz1R3W/9BgiLE23oOHJ90sRSmynVuB+qzxJN1Lm0X 3amthcFy3+clLJ3n1kKvdb1e4g== X-Received: by 2002:a1c:e408:: with SMTP id b8mr441275wmh.85.1621268422887; Mon, 17 May 2021 09:20:22 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r1sm2333011wrt.67.2021.05.17.09.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 09:20:14 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EA6601FFB4; Mon, 17 May 2021 17:10:25 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 29/29] plugins/hotpages: Properly freed the hash table values Date: Mon, 17 May 2021 17:10:22 +0100 Message-Id: <20210517161022.13984-30-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210517161022.13984-1-alex.bennee@linaro.org> References: <20210517161022.13984-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.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: Mahmoud Mandour , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.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> Message-Id: <20210505092259.8202-5-alex.bennee@linaro.org> -- 2.20.1 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,