On Tue, Mar 10, 2020 at 02:46:40PM +0800, Pan Nengyuan wrote: > 'type/id' forgot to free in qmp_object_add, this patch fix that. > > The leak stack: > Direct leak of 84 byte(s) in 6 object(s) allocated from: > #0 0x7fe2a5ebf768 in __interceptor_malloc (/lib64/libasan.so.5+0xef768) > #1 0x7fe2a5044445 in g_malloc (/lib64/libglib-2.0.so.0+0x52445) > #2 0x7fe2a505dd92 in g_strdup (/lib64/libglib-2.0.so.0+0x6bd92) > #3 0x56344954e692 in qmp_object_add > /mnt/sdb/qemu-new/qemu_test/qemu/qom/qom-qmp-cmds.c:258 > #4 0x563449960f5a in do_qmp_dispatch > /mnt/sdb/qemu-new/qemu_test/qemu/qapi/qmp-dispatch.c:132 > #5 0x563449960f5a in qmp_dispatch > /mnt/sdb/qemu-new/qemu_test/qemu/qapi/qmp-dispatch.c:175 > #6 0x563449498a30 in monitor_qmp_dispatch > /mnt/sdb/qemu-new/qemu_test/qemu/monitor/qmp.c:145 > #7 0x56344949a64f in monitor_qmp_bh_dispatcher > /mnt/sdb/qemu-new/qemu_test/qemu/monitor/qmp.c:234 > #8 0x563449a92a3a in aio_bh_call > /mnt/sdb/qemu-new/qemu_test/qemu/util/async.c:136 > > Direct leak of 54 byte(s) in 6 object(s) allocated from: > #0 0x7fe2a5ebf768 in __interceptor_malloc (/lib64/libasan.so.5+0xef768) > #1 0x7fe2a5044445 in g_malloc (/lib64/libglib-2.0.so.0+0x52445) > #2 0x7fe2a505dd92 in g_strdup (/lib64/libglib-2.0.so.0+0x6bd92) > #3 0x56344954e6c4 in qmp_object_add > /mnt/sdb/qemu-new/qemu_test/qemu/qom/qom-qmp-cmds.c:267 > #4 0x563449960f5a in do_qmp_dispatch > /mnt/sdb/qemu-new/qemu_test/qemu/qapi/qmp-dispatch.c:132 > #5 0x563449960f5a in qmp_dispatch > /mnt/sdb/qemu-new/qemu_test/qemu/qapi/qmp-dispatch.c:175 > #6 0x563449498a30 in monitor_qmp_dispatch > /mnt/sdb/qemu-new/qemu_test/qemu/monitor/qmp.c:145 > #7 0x56344949a64f in monitor_qmp_bh_dispatcher > /mnt/sdb/qemu-new/qemu_test/qemu/monitor/qmp.c:234 > #8 0x563449a92a3a in aio_bh_call > /mnt/sdb/qemu-new/qemu_test/qemu/util/async.c:136 > > Fixes: 5f07c4d60d091320186e7b0edaf9ed2cc16b2d1e > Reported-by: Euler Robot <euler.ro...@huawei.com> > Signed-off-by: Pan Nengyuan <pannengy...@huawei.com> > --- > v2->v1: > - do not store both a const and non-const string in the same variable, change > it to a non-const string. > (Suggested by Daniel P. Berrangé) > --- > qom/qom-qmp-cmds.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-)
Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|