From: Pino Toscano <ptoscano@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, mdroth@linux.vnet.ibm.com, ptoscano@redhat.com
Subject: [Qemu-devel] [PATCH] qapi: fix memory leak in QmpOutputVisitor
Date: Tue, 18 Oct 2016 11:17:47 +0200 [thread overview]
Message-ID: <1476782267-2602-1-git-send-email-ptoscano@redhat.com> (raw)
qmp_output_start_struct() and qmp_output_start_list() create a new
QObject (QDict, QList) and push it to the stack of the QmpOutputVisitor,
where it is saved as 'value'. When freeing the iterator in
qmp_output_free(), these values are never freed properly.
The simple solution is to qobject_decref() them.
---
qapi/qmp-output-visitor.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
index 9e3b67c..eedf256 100644
--- a/qapi/qmp-output-visitor.c
+++ b/qapi/qmp-output-visitor.c
@@ -220,6 +220,7 @@ static void qmp_output_free(Visitor *v)
while (!QSLIST_EMPTY(&qov->stack)) {
e = QSLIST_FIRST(&qov->stack);
QSLIST_REMOVE_HEAD(&qov->stack, node);
+ qobject_decref(e->value);
g_free(e);
}
--
2.7.4
next reply other threads:[~2016-10-18 9:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-18 9:17 Pino Toscano [this message]
2016-10-18 11:13 ` [Qemu-devel] [PATCH] qapi: fix memory leak in QmpOutputVisitor Eric Blake
2016-10-18 11:19 ` Eric Blake
2016-10-18 11:22 ` Pino Toscano
2016-10-21 21:20 ` Eric Blake
2016-10-24 11:40 ` Pino Toscano
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=1476782267-2602-1-git-send-email-ptoscano@redhat.com \
--to=ptoscano@redhat.com \
--cc=armbru@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/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).