diff mbox series

[v2,11/13] tests: fix qmp-test leak

Message ID 20171215150659.1811-12-marcandre.lureau@redhat.com
State New
Headers show
Series Various build-sys and ASAN related fixes | expand

Commit Message

Marc-André Lureau Dec. 15, 2017, 3:06 p.m. UTC
Direct leak of 913 byte(s) in 43 object(s) allocated from:
    #0 0x55880a15df60 in __interceptor_malloc (/home/elmarco/src/qq/build/tests/qmp-test+0x110f60)
    #1 0x7f3f20fd098f in _IO_vasprintf (/lib64/libc.so.6+0x8098f)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
 tests/qmp-test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Dec. 15, 2017, 6:11 p.m. UTC | #1
On 12/15/2017 12:06 PM, Marc-André Lureau wrote:
> Direct leak of 913 byte(s) in 43 object(s) allocated from:
>     #0 0x55880a15df60 in __interceptor_malloc (/home/elmarco/src/qq/build/tests/qmp-test+0x110f60)
>     #1 0x7f3f20fd098f in _IO_vasprintf (/lib64/libc.so.6+0x8098f)
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  tests/qmp-test.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qmp-test.c b/tests/qmp-test.c
> index c5a5c10b41..36feb2204b 100644
> --- a/tests/qmp-test.c
> +++ b/tests/qmp-test.c
> @@ -271,7 +271,7 @@ static void add_query_tests(QmpSchema *schema)
>  {
>      SchemaInfoList *tail;
>      SchemaInfo *si, *arg_type, *ret_type;
> -    const char *test_name;
> +    char *test_name;
>  
>      /* Test the query-like commands */
>      for (tail = schema->list; tail; tail = tail->next) {
> @@ -297,6 +297,7 @@ static void add_query_tests(QmpSchema *schema)
>  
>          test_name = g_strdup_printf("qmp/%s", si->name);
>          qtest_add_data_func(test_name, si->name, test_query);
> +        g_free(test_name);
>      }
>  }
>  
>
diff mbox series

Patch

diff --git a/tests/qmp-test.c b/tests/qmp-test.c
index c5a5c10b41..36feb2204b 100644
--- a/tests/qmp-test.c
+++ b/tests/qmp-test.c
@@ -271,7 +271,7 @@  static void add_query_tests(QmpSchema *schema)
 {
     SchemaInfoList *tail;
     SchemaInfo *si, *arg_type, *ret_type;
-    const char *test_name;
+    char *test_name;
 
     /* Test the query-like commands */
     for (tail = schema->list; tail; tail = tail->next) {
@@ -297,6 +297,7 @@  static void add_query_tests(QmpSchema *schema)
 
         test_name = g_strdup_printf("qmp/%s", si->name);
         qtest_add_data_func(test_name, si->name, test_query);
+        g_free(test_name);
     }
 }