From: Anton Johansson via <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org
Cc: ale@rev.ng, ltaylorsimpson@gmail.com, bcain@quicinc.com
Subject: [PATCH v2 3/4] target/hexagon: idef-parser fix leak of init_list
Date: Fri, 10 May 2024 16:52:43 +0200 [thread overview]
Message-ID: <20240510145244.5615-4-anjo@rev.ng> (raw)
In-Reply-To: <20240510145244.5615-1-anjo@rev.ng>
gen_inst_init_args() is called for instructions using a predicate as an
rvalue. Upon first call, the list of arguments which might need
initialization init_list is freed to indicate that they have been
processed. For instructions without an rvalue predicate,
gen_inst_init_args() isn't called and init_list will never be freed.
Free init_list from free_instruction() if it hasn't already been freed.
A comment in free_instruction is also updated.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
target/hexagon/idef-parser/parser-helpers.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/idef-parser/parser-helpers.c
index 95f2b43076..c150c308be 100644
--- a/target/hexagon/idef-parser/parser-helpers.c
+++ b/target/hexagon/idef-parser/parser-helpers.c
@@ -2121,9 +2121,16 @@ void free_instruction(Context *c)
g_string_free(g_array_index(c->inst.strings, GString*, i), TRUE);
}
g_array_free(c->inst.strings, TRUE);
+ /*
+ * Free list of arguments that might need initialization, if they haven't
+ * already been freed.
+ */
+ if (c->inst.init_list) {
+ g_array_free(c->inst.init_list, TRUE);
+ }
/* Free INAME token value */
g_string_free(c->inst.name, TRUE);
- /* Free variables and registers */
+ /* Free declared TCGv variables */
g_array_free(c->inst.allocated, TRUE);
/* Initialize instruction-specific portion of the context */
memset(&(c->inst), 0, sizeof(Inst));
--
2.45.0
next prev parent reply other threads:[~2024-05-10 14:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 14:52 [PATCH v2 0/4] target/hexagon: Minor idef-parser cleanup Anton Johansson via
2024-05-10 14:52 ` [PATCH v2 1/4] target/hexagon: idef-parser remove unused defines Anton Johansson via
2024-05-10 14:52 ` [PATCH v2 2/4] target/hexagon: idef-parser remove undefined functions Anton Johansson via
2024-05-10 14:52 ` Anton Johansson via [this message]
2024-05-20 20:04 ` [PATCH v2 3/4] target/hexagon: idef-parser fix leak of init_list ltaylorsimpson
2024-05-10 14:52 ` [PATCH v2 4/4] target/hexagon: idef-parser simplify predicate init Anton Johansson via
2024-05-20 20:03 ` ltaylorsimpson
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=20240510145244.5615-4-anjo@rev.ng \
--to=qemu-devel@nongnu.org \
--cc=ale@rev.ng \
--cc=anjo@rev.ng \
--cc=bcain@quicinc.com \
--cc=ltaylorsimpson@gmail.com \
/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).