mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
No description
8f91ad8a1b
In qmp-marshal.c the dealloc visitor calls use the same errp pointer of the input visitor calls. This means that if any of the input visitor calls fails, then the dealloc visitor will return early, before freeing the object's memory. Here's an example, consider this code: int qmp_marshal_input_block_passwd(Monitor *mon, const QDict *qdict, QObject **ret) { [...] char * device = NULL; char * password = NULL; mi = qmp_input_visitor_new_strict(QOBJECT(args)); v = qmp_input_get_visitor(mi); visit_type_str(v, &device, "device", errp); visit_type_str(v, &password, "password", errp); qmp_input_visitor_cleanup(mi); if (error_is_set(errp)) { goto out; } qmp_block_passwd(device, password, errp); out: md = qapi_dealloc_visitor_new(); v = qapi_dealloc_get_visitor(md); visit_type_str(v, &device, "device", errp); visit_type_str(v, &password, "password", errp); qapi_dealloc_visitor_cleanup(md); [...] return 0; } Consider errp != NULL when the out label is reached, we're going to leak device and password. This patch fixes this by always passing errp=NULL for dealloc visitors, meaning that we always try to free them regardless of any previous failure. The above example would then be: out: md = qapi_dealloc_visitor_new(); v = qapi_dealloc_get_visitor(md); visit_type_str(v, &device, "device", NULL); visit_type_str(v, &password, "password", NULL); qapi_dealloc_visitor_cleanup(md); Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> |
||
---|---|---|
audio | ||
backends | ||
block | ||
bsd-user | ||
default-configs | ||
disas | ||
docs | ||
dtc@bc895d6d09 | ||
fpu | ||
fsdev | ||
gdb-xml | ||
hw | ||
include | ||
ldscripts | ||
libcacard | ||
linux-headers | ||
linux-user | ||
net | ||
pc-bios | ||
pixman@97336fad32 | ||
po | ||
qapi | ||
qga | ||
QMP | ||
qobject | ||
qom | ||
roms | ||
scripts | ||
slirp | ||
stubs | ||
sysconfigs/target | ||
target-alpha | ||
target-arm | ||
target-cris | ||
target-i386 | ||
target-lm32 | ||
target-m68k | ||
target-microblaze | ||
target-mips | ||
target-moxie | ||
target-openrisc | ||
target-ppc | ||
target-s390x | ||
target-sh4 | ||
target-sparc | ||
target-unicore32 | ||
target-xtensa | ||
tcg | ||
tests | ||
trace | ||
ui | ||
util | ||
.exrc | ||
.gitignore | ||
.gitmodules | ||
.mailmap | ||
aio-posix.c | ||
aio-win32.c | ||
arch_init.c | ||
async.c | ||
balloon.c | ||
block-migration.c | ||
block.c | ||
blockdev-nbd.c | ||
blockdev.c | ||
blockjob.c | ||
bt-host.c | ||
bt-vhci.c | ||
Changelog | ||
CODING_STYLE | ||
configure | ||
COPYING | ||
COPYING.LIB | ||
coroutine-gthread.c | ||
coroutine-sigaltstack.c | ||
coroutine-ucontext.c | ||
coroutine-win32.c | ||
cpu-exec.c | ||
cpus.c | ||
cputlb.c | ||
device-hotplug.c | ||
device_tree.c | ||
disas.c | ||
dma-helpers.c | ||
dump.c | ||
exec.c | ||
gdbstub.c | ||
HACKING | ||
hmp-commands.hx | ||
hmp.c | ||
hmp.h | ||
iohandler.c | ||
ioport.c | ||
kvm-all.c | ||
kvm-stub.c | ||
LICENSE | ||
main-loop.c | ||
MAINTAINERS | ||
Makefile | ||
Makefile.objs | ||
Makefile.target | ||
memory.c | ||
memory_mapping.c | ||
migration-exec.c | ||
migration-fd.c | ||
migration-tcp.c | ||
migration-unix.c | ||
migration.c | ||
monitor.c | ||
nbd.c | ||
os-posix.c | ||
os-win32.c | ||
page_cache.c | ||
qapi-schema-test.json | ||
qapi-schema.json | ||
qdev-monitor.c | ||
qdict-test-data.txt | ||
qemu-bridge-helper.c | ||
qemu-char.c | ||
qemu-coroutine-io.c | ||
qemu-coroutine-lock.c | ||
qemu-coroutine-sleep.c | ||
qemu-coroutine.c | ||
qemu-doc.texi | ||
qemu-img-cmds.hx | ||
qemu-img.c | ||
qemu-img.texi | ||
qemu-io-cmds.c | ||
qemu-io.c | ||
qemu-log.c | ||
qemu-nbd.c | ||
qemu-nbd.texi | ||
qemu-options-wrapper.h | ||
qemu-options.h | ||
qemu-options.hx | ||
qemu-seccomp.c | ||
qemu-tech.texi | ||
qemu-timer.c | ||
qemu.sasl | ||
qmp-commands.hx | ||
qmp.c | ||
qtest.c | ||
readline.c | ||
README | ||
rules.mak | ||
savevm.c | ||
spice-qemu-char.c | ||
tcg-runtime.c | ||
tci.c | ||
thread-pool.c | ||
thunk.c | ||
tpm.c | ||
trace-events | ||
translate-all.c | ||
translate-all.h | ||
user-exec.c | ||
VERSION | ||
version.rc | ||
vl.c | ||
xbzrle.c | ||
xen-all.c | ||
xen-mapcache.c | ||
xen-stub.c |
Read the documentation in qemu-doc.html or on http://wiki.qemu.org - QEMU team