diff mbox series

[1/4] tests: fix crumple/recursive leak

Message ID 20180809114417.28718-2-marcandre.lureau@redhat.com
State New
Headers show
Series Memory leak fixes | expand

Commit Message

Marc-André Lureau Aug. 9, 2018, 11:44 a.m. UTC
Spotted by ASAN:

Comments

Markus Armbruster Aug. 10, 2018, 6:25 a.m. UTC | #1
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Spotted by ASAN:
>
> =================================================================
> ==27907==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 4120 byte(s) in 1 object(s) allocated from:
>     #0 0x7f913458ce50 in calloc (/lib64/libasan.so.5+0xeee50)
>     #1 0x7f9133fd641d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d)
>     #2 0x5561c6643c95 in qdict_crumple_test_recursive /home/elmarco/src/qq/tests/check-block-qdict.c:438
>     #3 0x7f9133ff7c49  (/lib64/libglib-2.0.so.0+0x73c49)
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/check-block-qdict.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/check-block-qdict.c b/tests/check-block-qdict.c
> index 478807f839..73d3e9f574 100644
> --- a/tests/check-block-qdict.c
> +++ b/tests/check-block-qdict.c
> @@ -491,6 +491,7 @@ static void qdict_crumple_test_recursive(void)
>      empty_list_0 = qobject_to(QDict, qlist_pop(empty_list));
>      g_assert(empty_list_0);
>      g_assert_cmpint(qdict_size(empty_list_0), ==, 0);
> +    qobject_unref(empty_list_0);
>  
>      qobject_unref(src);
>      qobject_unref(dst);

Screwed up in commit 2860b2b2cb8.  I can add that to the commit message
when I apply.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
diff mbox series

Patch

=================================================================
==27907==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4120 byte(s) in 1 object(s) allocated from:
    #0 0x7f913458ce50 in calloc (/lib64/libasan.so.5+0xeee50)
    #1 0x7f9133fd641d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d)
    #2 0x5561c6643c95 in qdict_crumple_test_recursive /home/elmarco/src/qq/tests/check-block-qdict.c:438
    #3 0x7f9133ff7c49  (/lib64/libglib-2.0.so.0+0x73c49)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/check-block-qdict.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/check-block-qdict.c b/tests/check-block-qdict.c
index 478807f839..73d3e9f574 100644
--- a/tests/check-block-qdict.c
+++ b/tests/check-block-qdict.c
@@ -491,6 +491,7 @@  static void qdict_crumple_test_recursive(void)
     empty_list_0 = qobject_to(QDict, qlist_pop(empty_list));
     g_assert(empty_list_0);
     g_assert_cmpint(qdict_size(empty_list_0), ==, 0);
+    qobject_unref(empty_list_0);
 
     qobject_unref(src);
     qobject_unref(dst);