Commit 3e829c0
qtest/npcm7xx_pwm-test: Fix memleak in pwm_qom_get
The pwm_qom_get function didn't free "response", which caused an indirect
memory leak. So use qobject_unref() to fix it.
ASAN shows memory leak stack:
Indirect leak of 74160000 byte(s) in 18000 object(s) allocated from:
#0 0x7f96e2f79d4e in __interceptor_calloc (/lib64/libasan.so.5+0x112d4e)
#1 0x7f96e2d98a50 in g_malloc0 (/lib64/libglib-2.0.so.0+0x55a50)
qemu#2 0x556313112180 in qdict_new ../qobject/qdict.c:30
qemu#3 0x556313115bca in parse_object ../qobject/json-parser.c:318
qemu#4 0x556313117810 in parse_value ../qobject/json-parser.c:546
qemu#5 0x556313117bda in json_parser_parse ../qobject/json-parser.c:580
qemu#6 0x55631310fe67 in json_message_process_token ../qobject/json-streamer.c:92
qemu#7 0x5563131210b7 in json_lexer_feed_char ../qobject/json-lexer.c:313
qemu#8 0x556313121662 in json_lexer_feed ../qobject/json-lexer.c:350
qemu#9 0x5563131101e9 in json_message_parser_feed ../qobject/json-streamer.c:121
qemu#10 0x5563130cb81e in qmp_fd_receive ../tests/qtest/libqtest.c:614
qemu#11 0x5563130cba2b in qtest_qmp_receive_dict ../tests/qtest/libqtest.c:636
qemu#12 0x5563130cb939 in qtest_qmp_receive ../tests/qtest/libqtest.c:624
qemu#13 0x5563130cbe0d in qtest_vqmp ../tests/qtest/libqtest.c:715
qemu#14 0x5563130cc40f in qtest_qmp ../tests/qtest/libqtest.c:756
qemu#15 0x5563130c5623 in pwm_qom_get ../tests/qtest/npcm7xx_pwm-test.c:180
qemu#16 0x5563130c595e in pwm_get_duty ../tests/qtest/npcm7xx_pwm-test.c:210
qemu#17 0x5563130c7529 in test_toggle ../tests/qtest/npcm7xx_pwm-test.c:447
Reported-by: Euler Robot <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Gan Qixin <[email protected]>
Reviewed-by: Havard Skinnemoen <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Hao Wu <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>1 parent b22786e commit 3e829c0
1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
185 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
186 | 189 | | |
187 | 190 | | |
188 | 191 | | |
| |||
0 commit comments