aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-11-20 13:09:20 +0100
committerKevin Wolf <kwolf@redhat.com>2013-11-29 13:40:37 +0100
commit6273d1136af913aaf4badc4545ccf942557c747b (patch)
tree7d553b076edf146414609a5294e042a58c5af0bb
parentdce32b6c2bfd5132c433638352eea6f7707caf9c (diff)
downloadqemu-6273d1136af913aaf4badc4545ccf942557c747b.zip
qemu-6273d1136af913aaf4badc4545ccf942557c747b.tar.gz
qemu-6273d1136af913aaf4badc4545ccf942557c747b.tar.bz2
qdict: Fix memory leak in qdict_do_flatten()
Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--qobject/qdict.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/qobject/qdict.c b/qobject/qdict.c
index 0f3e0a6..60d6cd5 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -481,7 +481,7 @@ static void qdict_do_flatten(QDict *qdict, QDict *target, const char *prefix)
{
QObject *value;
const QDictEntry *entry, *next;
- const char *new_key;
+ char *new_key;
bool delete;
entry = qdict_first(qdict);
@@ -506,6 +506,8 @@ static void qdict_do_flatten(QDict *qdict, QDict *target, const char *prefix)
delete = true;
}
+ g_free(new_key);
+
if (delete) {
qdict_del(qdict, entry->key);