qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	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" <ma.mandourr@gmail.com>,
	matheus.ferst@eldorado.org.br
Subject: [PATCH v1 4/7] plugins/hotpages: Properly freed the hash table values
Date: Wed,  5 May 2021 10:22:56 +0100	[thread overview]
Message-ID: <20210505092259.8202-5-alex.bennee@linaro.org> (raw)
In-Reply-To: <20210505092259.8202-1-alex.bennee@linaro.org>

From: Mahmoud Mandour <ma.mandourr@gmail.com>

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 <ma.mandourr@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
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,
-- 
2.20.1



  parent reply	other threads:[~2021-05-05  9:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05  9:22 [PATCH v1 0/7] plugins/next (windows, leaks, tcg tracing) Alex Bennée
2021-05-05  9:22 ` [PATCH v1 1/7] plugins: Update qemu-plugins.symbols to match qemu-plugins.h Alex Bennée
2021-05-05  9:22 ` [PATCH v1 2/7] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h Alex Bennée
2021-05-05  9:22 ` [PATCH v1 3/7] plugins/hotblocks: Properly freed the hash table values Alex Bennée
2021-05-05  9:22 ` Alex Bennée [this message]
2021-05-05  9:22 ` [PATCH v1 5/7] docs: mark intention to deprecate TCG tracing functionality Alex Bennée
2021-05-05  9:33   ` Daniel P. Berrangé
2021-05-05 10:35     ` Alex Bennée
2021-05-05 10:41       ` Alex Bennée
2021-05-05 10:52         ` Daniel P. Berrangé
2021-05-17 10:47           ` Alex Bennée
2021-05-17 13:44             ` Stefan Hajnoczi
2021-05-05  9:22 ` [PATCH v1 6/7] scripts/tracetool: don't barf validating TCG types Alex Bennée
2021-05-05  9:22 ` [PATCH v1 7/7] tcg: add trace events for [exit|goto]_tb and goto_ptr Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505092259.8202-5-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=aaron@os.amperecomputing.com \
    --cc=cota@braap.org \
    --cc=kuhn.chenqun@huawei.com \
    --cc=ma.mandourr@gmail.com \
    --cc=mahmoudabdalghany@outlook.com \
    --cc=matheus.ferst@eldorado.org.br \
    --cc=minyihh@uci.edu \
    --cc=mohamad.gebai@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=robhenry@microsoft.com \
    --cc=stefanha@redhat.com \
    --cc=vilanova@imperial.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).