* [Qemu-devel] [PATCH] tests: check-qjson: fix a memory leak
@ 2018-10-02 16:26 Li Qiang
2018-10-02 16:43 ` Eric Blake
2018-10-02 16:49 ` Marc-André Lureau
0 siblings, 2 replies; 3+ messages in thread
From: Li Qiang @ 2018-10-02 16:26 UTC (permalink / raw)
To: armbru; +Cc: qemu-devel, Li Qiang
Spotted by ASAN.
=================================================================
==17531==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1120 byte(s) in 28 object(s) allocated from:
#0 0x7f9fb85eeb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
#1 0x7f9fb824b8d8 in g_malloc (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x518d8)
#2 0x5654ae94f073 in qstring_from_str qobject/qstring.c:66
#3 0x5654ae94ede7 in qstring_new qobject/qstring.c:23
#4 0x5654ae953b6b in parse_string qobject/json-parser.c:143
#5 0x5654ae955e3e in parse_literal qobject/json-parser.c:484
#6 0x5654ae956227 in parse_value qobject/json-parser.c:547
#7 0x5654ae9565c7 in json_parser_parse qobject/json-parser.c:573
#8 0x5654ae952d5d in json_message_process_token qobject/json-streamer.c:92
#9 0x5654ae9608fa in json_lexer_feed_char qobject/json-lexer.c:313
#10 0x5654ae960ea5 in json_lexer_feed qobject/json-lexer.c:350
#11 0x5654ae9530de in json_message_parser_feed qobject/json-streamer.c:121
#12 0x5654ae950b6e in qobject_from_jsonv qobject/qjson.c:69
#13 0x5654ae950d30 in qobject_from_json qobject/qjson.c:83
#14 0x5654ae9449af in from_json_str tests/check-qjson.c:30
#15 0x5654ae946399 in utf8_string tests/check-qjson.c:781
#16 0x7f9fb826cc39 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72c39)
Signed-off-by: Li Qiang <liq3ea@163.com>
---
tests/check-qjson.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/check-qjson.c b/tests/check-qjson.c
index cc13f3d41e..d876a7a96e 100644
--- a/tests/check-qjson.c
+++ b/tests/check-qjson.c
@@ -780,6 +780,7 @@ static void utf8_string(void)
if (!strstr(json_out, "\\uFFFD")) {
str = from_json_str(json_out, j, &error_abort);
g_assert_cmpstr(qstring_get_try_str(str), ==, utf8_in);
+ qobject_unref(str);
}
}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Qemu-devel] [PATCH] tests: check-qjson: fix a memory leak
2018-10-02 16:26 [Qemu-devel] [PATCH] tests: check-qjson: fix a memory leak Li Qiang
@ 2018-10-02 16:43 ` Eric Blake
2018-10-02 16:49 ` Marc-André Lureau
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2018-10-02 16:43 UTC (permalink / raw)
To: Li Qiang, armbru; +Cc: qemu-devel
On 10/2/18 11:26 AM, Li Qiang wrote:
> Spotted by ASAN.
>
> =================================================================
> ==17531==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 1120 byte(s) in 28 object(s) allocated from:
> #0 0x7f9fb85eeb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
> #1 0x7f9fb824b8d8 in g_malloc (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x518d8)
> #2 0x5654ae94f073 in qstring_from_str qobject/qstring.c:66
> #3 0x5654ae94ede7 in qstring_new qobject/qstring.c:23
> #4 0x5654ae953b6b in parse_string qobject/json-parser.c:143
> #5 0x5654ae955e3e in parse_literal qobject/json-parser.c:484
> #6 0x5654ae956227 in parse_value qobject/json-parser.c:547
> #7 0x5654ae9565c7 in json_parser_parse qobject/json-parser.c:573
> #8 0x5654ae952d5d in json_message_process_token qobject/json-streamer.c:92
> #9 0x5654ae9608fa in json_lexer_feed_char qobject/json-lexer.c:313
> #10 0x5654ae960ea5 in json_lexer_feed qobject/json-lexer.c:350
> #11 0x5654ae9530de in json_message_parser_feed qobject/json-streamer.c:121
> #12 0x5654ae950b6e in qobject_from_jsonv qobject/qjson.c:69
> #13 0x5654ae950d30 in qobject_from_json qobject/qjson.c:83
> #14 0x5654ae9449af in from_json_str tests/check-qjson.c:30
> #15 0x5654ae946399 in utf8_string tests/check-qjson.c:781
> #16 0x7f9fb826cc39 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72c39)
>
> Signed-off-by: Li Qiang <liq3ea@163.com>
> ---
> tests/check-qjson.c | 1 +
> 1 file changed, 1 insertion(+)
Latent in commit 6ad8444f6, became a bug in commit c473c379.
Reviewed-by: Eric Blake <eblake@redhat.com>
>
> diff --git a/tests/check-qjson.c b/tests/check-qjson.c
> index cc13f3d41e..d876a7a96e 100644
> --- a/tests/check-qjson.c
> +++ b/tests/check-qjson.c
> @@ -780,6 +780,7 @@ static void utf8_string(void)
> if (!strstr(json_out, "\\uFFFD")) {
> str = from_json_str(json_out, j, &error_abort);
> g_assert_cmpstr(qstring_get_try_str(str), ==, utf8_in);
> + qobject_unref(str);
> }
> }
> }
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Qemu-devel] [PATCH] tests: check-qjson: fix a memory leak
2018-10-02 16:26 [Qemu-devel] [PATCH] tests: check-qjson: fix a memory leak Li Qiang
2018-10-02 16:43 ` Eric Blake
@ 2018-10-02 16:49 ` Marc-André Lureau
1 sibling, 0 replies; 3+ messages in thread
From: Marc-André Lureau @ 2018-10-02 16:49 UTC (permalink / raw)
To: liq3ea; +Cc: Markus Armbruster, QEMU
Hi
On Tue, Oct 2, 2018 at 8:27 PM Li Qiang <liq3ea@163.com> wrote:
>
> Spotted by ASAN.
>
> =================================================================
> ==17531==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 1120 byte(s) in 28 object(s) allocated from:
> #0 0x7f9fb85eeb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
> #1 0x7f9fb824b8d8 in g_malloc (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x518d8)
> #2 0x5654ae94f073 in qstring_from_str qobject/qstring.c:66
> #3 0x5654ae94ede7 in qstring_new qobject/qstring.c:23
> #4 0x5654ae953b6b in parse_string qobject/json-parser.c:143
> #5 0x5654ae955e3e in parse_literal qobject/json-parser.c:484
> #6 0x5654ae956227 in parse_value qobject/json-parser.c:547
> #7 0x5654ae9565c7 in json_parser_parse qobject/json-parser.c:573
> #8 0x5654ae952d5d in json_message_process_token qobject/json-streamer.c:92
> #9 0x5654ae9608fa in json_lexer_feed_char qobject/json-lexer.c:313
> #10 0x5654ae960ea5 in json_lexer_feed qobject/json-lexer.c:350
> #11 0x5654ae9530de in json_message_parser_feed qobject/json-streamer.c:121
> #12 0x5654ae950b6e in qobject_from_jsonv qobject/qjson.c:69
> #13 0x5654ae950d30 in qobject_from_json qobject/qjson.c:83
> #14 0x5654ae9449af in from_json_str tests/check-qjson.c:30
> #15 0x5654ae946399 in utf8_string tests/check-qjson.c:781
> #16 0x7f9fb826cc39 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72c39)
>
> Signed-off-by: Li Qiang <liq3ea@163.com>
already sent and queued by Markus:
https://patchew.org/QEMU/20180901211917.10372-1-marcandre.lureau@redhat.com/
> ---
> tests/check-qjson.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tests/check-qjson.c b/tests/check-qjson.c
> index cc13f3d41e..d876a7a96e 100644
> --- a/tests/check-qjson.c
> +++ b/tests/check-qjson.c
> @@ -780,6 +780,7 @@ static void utf8_string(void)
> if (!strstr(json_out, "\\uFFFD")) {
> str = from_json_str(json_out, j, &error_abort);
> g_assert_cmpstr(qstring_get_try_str(str), ==, utf8_in);
> + qobject_unref(str);
> }
> }
> }
> --
> 2.17.1
>
>
>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-02 16:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-02 16:26 [Qemu-devel] [PATCH] tests: check-qjson: fix a memory leak Li Qiang
2018-10-02 16:43 ` Eric Blake
2018-10-02 16:49 ` Marc-André Lureau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).