]> git.ipfire.org Git - thirdparty/qemu.git/commit
json-streamer: fix double-free on exiting during a parse
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 4 Jul 2016 12:40:59 +0000 (14:40 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 4 Aug 2016 21:34:29 +0000 (16:34 -0500)
commit2522f0fcd17218a0c8f513663ce868410dc120c9
tree6a40418511aaba1bd3239f62fdd48bf956b2010a
parentebe0376e8cd0a6b2318096992a0902663d58e522
json-streamer: fix double-free on exiting during a parse

Now that json-streamer tries not to leak tokens on incomplete parse,
the tokens can be freed twice if QEMU destroys the json-streamer
object during the parser->emit call.  To fix this, create the new
empty GQueue earlier, so that it is already in place when the old
one is passed to parser->emit.

Reported-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1467636059-12557-1-git-send-email-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit a942d8fa01f65279cdc135f4294db611bbc088ef)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qobject/json-streamer.c