[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/12] qom-hmp-cmds: fix a memleak in hmp_qom_get
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 02/12] qom-hmp-cmds: fix a memleak in hmp_qom_get |
Date: |
Wed, 17 Jun 2020 19:37:23 +0100 |
From: Pan Nengyuan <pannengyuan@huawei.com>
'obj' forgot to free at the end of hmp_qom_get(). Fix that.
The leak stack:
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7f4e3a779ae8 in __interceptor_malloc (/lib64/libasan.so.5+0xefae8)
#1 0x7f4e398f91d5 in g_malloc (/lib64/libglib-2.0.so.0+0x531d5)
#2 0x55c9fd9a3999 in qstring_from_substr
/build/qemu/src/qobject/qstring.c:45
#3 0x55c9fd894bd3 in qobject_output_type_str
/build/qemu/src/qapi/qobject-output-visitor.c:175
#4 0x55c9fd894bd3 in qobject_output_type_str
/build/qemu/src/qapi/qobject-output-visitor.c:168
#5 0x55c9fd88b34d in visit_type_str
/build/qemu/src/qapi/qapi-visit-core.c:308
#6 0x55c9fd59aa6b in property_get_str /build/qemu/src/qom/object.c:2064
#7 0x55c9fd5adb8a in object_property_get_qobject
/build/qemu/src/qom/qom-qobject.c:38
#8 0x55c9fd4a029d in hmp_qom_get /build/qemu/src/qom/qom-hmp-cmds.c:66
Fixes: 89cf4fe34f4
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Message-Id: <20200603070338.7922-1-pannengyuan@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Tested-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
qom/qom-hmp-cmds.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c
index 99385b6ad2..158e2d7409 100644
--- a/qom/qom-hmp-cmds.c
+++ b/qom/qom-hmp-cmds.c
@@ -71,6 +71,7 @@ void hmp_qom_get(Monitor *mon, const QDict *qdict)
qobject_unref(str);
}
+ qobject_unref(obj);
hmp_handle_error(mon, err);
}
--
2.26.2
- [PULL 00/12] migration, HMP and virtiofs queue, Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 01/12] virtiofsd: Whitelist fchmod, Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 04/12] tests/migration: mem leak fix, Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 03/12] hmp: Make json format optional for qom-set, Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 05/12] tests/migration: fix unreachable path in stress test, Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 02/12] qom-hmp-cmds: fix a memleak in hmp_qom_get,
Dr. David Alan Gilbert (git) <=
- [PULL 06/12] monitor/hmp-cmds: add units for migrate_parameters, Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 07/12] monitor/hmp-cmds: don't silently output when running 'migrate_set_downtime' fails, Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 08/12] monitor/hmp-cmds: delete redundant Error check before invoke hmp_handle_error(), Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 10/12] monitor/hmp-cmds: improvements for the 'info migrate', Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 09/12] monitor/hmp-cmds: add 'goto end' to reduce duplicate code., Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 11/12] docs/xbzrle: update 'cache miss rate' and 'encoding rate' to docs, Dr. David Alan Gilbert (git), 2020/06/17
- [PULL 12/12] migration: fix multifd_send_pages() next channel, Dr. David Alan Gilbert (git), 2020/06/17
- Re: [PULL 00/12] migration, HMP and virtiofs queue, no-reply, 2020/06/17
- Re: [PULL 00/12] migration, HMP and virtiofs queue, Peter Maydell, 2020/06/18