qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vl: fix memory leak in configure_accelerators
@ 2020-01-08 11:42 kuhn.chenqun
  2020-01-08 14:56 ` Philippe Mathieu-Daudé
  2020-01-08 15:13 ` Laurent Vivier
  0 siblings, 2 replies; 4+ messages in thread
From: kuhn.chenqun @ 2020-01-08 11:42 UTC (permalink / raw)
  To: qemu-devel, pbonzini; +Cc: liyiting, Chen Qun, pannengyuan, zhang.zhanghailiang

From: Chen Qun <kuhn.chenqun@huawei.com>

The accel_list forgot to free, the asan output:

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xffff919331cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
    #1 0xffff913f7163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
    #2 0xffff91413d9b in g_strsplit (/lib64/libglib-2.0.so.0+0x73d9b)
    #3 0xaaab42fb58e7 in configure_accelerators /qemu/vl.c:2777
    #4 0xaaab42fb58e7 in main /qemu/vl.c:4121
    #5 0xffff8f9b0b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
    #6 0xaaab42fc1dab  (/qemu/build/aarch64-softmmu/qemu-system-aarch64+0x8b1dab)

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0xffff919331cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
    #1 0xffff913f7163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
    #2 0xffff9141243b in g_strdup (/lib64/libglib-2.0.so.0+0x7243b)
    #3 0xffff91413e6f in g_strsplit (/lib64/libglib-2.0.so.0+0x73e6f)
    #4 0xaaab42fb58e7 in configure_accelerators /qemu/vl.c:2777
    #5 0xaaab42fb58e7 in main /qemu/vl.c:4121
    #6 0xffff8f9b0b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
    #7 0xaaab42fc1dab  (/qemu/build/aarch64-softmmu/qemu-system-aarch64+0x8b1dab)

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
 vl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vl.c b/vl.c
index 86474a55c9..035a24e52b 100644
--- a/vl.c
+++ b/vl.c
@@ -2788,6 +2788,7 @@ static void configure_accelerators(const char *progname)
                 error_report("invalid accelerator %s", *tmp);
             }
         }
+        g_strfreev(accel_list);
     } else {
         if (accel != NULL) {
             error_report("The -accel and \"-machine accel=\" options are incompatible");
-- 
2.23.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vl: fix memory leak in configure_accelerators
  2020-01-08 11:42 [PATCH] vl: fix memory leak in configure_accelerators kuhn.chenqun
@ 2020-01-08 14:56 ` Philippe Mathieu-Daudé
  2020-01-08 14:59   ` Paolo Bonzini
  2020-01-08 15:13 ` Laurent Vivier
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-01-08 14:56 UTC (permalink / raw)
  To: kuhn.chenqun, qemu-devel, pbonzini
  Cc: liyiting, pannengyuan, zhang.zhanghailiang

On 1/8/20 12:42 PM, kuhn.chenqun@huawei.com wrote:
> From: Chen Qun <kuhn.chenqun@huawei.com>
> 
> The accel_list forgot to free, the asan output:
> 
> Direct leak of 16 byte(s) in 1 object(s) allocated from:
>      #0 0xffff919331cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
>      #1 0xffff913f7163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
>      #2 0xffff91413d9b in g_strsplit (/lib64/libglib-2.0.so.0+0x73d9b)
>      #3 0xaaab42fb58e7 in configure_accelerators /qemu/vl.c:2777
>      #4 0xaaab42fb58e7 in main /qemu/vl.c:4121
>      #5 0xffff8f9b0b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
>      #6 0xaaab42fc1dab  (/qemu/build/aarch64-softmmu/qemu-system-aarch64+0x8b1dab)
> 
> Indirect leak of 4 byte(s) in 1 object(s) allocated from:
>      #0 0xffff919331cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
>      #1 0xffff913f7163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
>      #2 0xffff9141243b in g_strdup (/lib64/libglib-2.0.so.0+0x7243b)
>      #3 0xffff91413e6f in g_strsplit (/lib64/libglib-2.0.so.0+0x73e6f)
>      #4 0xaaab42fb58e7 in configure_accelerators /qemu/vl.c:2777
>      #5 0xaaab42fb58e7 in main /qemu/vl.c:4121
>      #6 0xffff8f9b0b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
>      #7 0xaaab42fc1dab  (/qemu/build/aarch64-softmmu/qemu-system-aarch64+0x8b1dab)
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   vl.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/vl.c b/vl.c
> index 86474a55c9..035a24e52b 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2788,6 +2788,7 @@ static void configure_accelerators(const char *progname)
>                   error_report("invalid accelerator %s", *tmp);
>               }
>           }
> +        g_strfreev(accel_list);
>       } else {
>           if (accel != NULL) {
>               error_report("The -accel and \"-machine accel=\" options are incompatible");
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vl: fix memory leak in configure_accelerators
  2020-01-08 14:56 ` Philippe Mathieu-Daudé
@ 2020-01-08 14:59   ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2020-01-08 14:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, kuhn.chenqun, qemu-devel
  Cc: liyiting, qemu-trivial, pannengyuan, zhang.zhanghailiang

On 08/01/20 15:56, Philippe Mathieu-Daudé wrote:
> On 1/8/20 12:42 PM, kuhn.chenqun@huawei.com wrote:
>> From: Chen Qun <kuhn.chenqun@huawei.com>
>>
>> The accel_list forgot to free, the asan output:
>>
>> Direct leak of 16 byte(s) in 1 object(s) allocated from:
>>      #0 0xffff919331cb in __interceptor_malloc
>> (/lib64/libasan.so.4+0xd31cb)
>>      #1 0xffff913f7163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
>>      #2 0xffff91413d9b in g_strsplit (/lib64/libglib-2.0.so.0+0x73d9b)
>>      #3 0xaaab42fb58e7 in configure_accelerators /qemu/vl.c:2777
>>      #4 0xaaab42fb58e7 in main /qemu/vl.c:4121
>>      #5 0xffff8f9b0b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
>>      #6 0xaaab42fc1dab 
>> (/qemu/build/aarch64-softmmu/qemu-system-aarch64+0x8b1dab)
>>
>> Indirect leak of 4 byte(s) in 1 object(s) allocated from:
>>      #0 0xffff919331cb in __interceptor_malloc
>> (/lib64/libasan.so.4+0xd31cb)
>>      #1 0xffff913f7163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
>>      #2 0xffff9141243b in g_strdup (/lib64/libglib-2.0.so.0+0x7243b)
>>      #3 0xffff91413e6f in g_strsplit (/lib64/libglib-2.0.so.0+0x73e6f)
>>      #4 0xaaab42fb58e7 in configure_accelerators /qemu/vl.c:2777
>>      #5 0xaaab42fb58e7 in main /qemu/vl.c:4121
>>      #6 0xffff8f9b0b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
>>      #7 0xaaab42fc1dab 
>> (/qemu/build/aarch64-softmmu/qemu-system-aarch64+0x8b1dab)
>>
>> Reported-by: Euler Robot <euler.robot@huawei.com>
>> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
>> ---
>>   vl.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/vl.c b/vl.c
>> index 86474a55c9..035a24e52b 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -2788,6 +2788,7 @@ static void configure_accelerators(const char
>> *progname)
>>                   error_report("invalid accelerator %s", *tmp);
>>               }
>>           }
>> +        g_strfreev(accel_list);
>>       } else {
>>           if (accel != NULL) {
>>               error_report("The -accel and \"-machine accel=\" options
>> are incompatible");
>>
> 

Cc; qemu-trivial@nongnu.org



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vl: fix memory leak in configure_accelerators
  2020-01-08 11:42 [PATCH] vl: fix memory leak in configure_accelerators kuhn.chenqun
  2020-01-08 14:56 ` Philippe Mathieu-Daudé
@ 2020-01-08 15:13 ` Laurent Vivier
  1 sibling, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2020-01-08 15:13 UTC (permalink / raw)
  To: kuhn.chenqun, qemu-devel, pbonzini
  Cc: liyiting, pannengyuan, zhang.zhanghailiang

Le 08/01/2020 à 12:42, kuhn.chenqun@huawei.com a écrit :
> From: Chen Qun <kuhn.chenqun@huawei.com>
> 
> The accel_list forgot to free, the asan output:
> 
> Direct leak of 16 byte(s) in 1 object(s) allocated from:
>     #0 0xffff919331cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
>     #1 0xffff913f7163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
>     #2 0xffff91413d9b in g_strsplit (/lib64/libglib-2.0.so.0+0x73d9b)
>     #3 0xaaab42fb58e7 in configure_accelerators /qemu/vl.c:2777
>     #4 0xaaab42fb58e7 in main /qemu/vl.c:4121
>     #5 0xffff8f9b0b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
>     #6 0xaaab42fc1dab  (/qemu/build/aarch64-softmmu/qemu-system-aarch64+0x8b1dab)
> 
> Indirect leak of 4 byte(s) in 1 object(s) allocated from:
>     #0 0xffff919331cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
>     #1 0xffff913f7163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
>     #2 0xffff9141243b in g_strdup (/lib64/libglib-2.0.so.0+0x7243b)
>     #3 0xffff91413e6f in g_strsplit (/lib64/libglib-2.0.so.0+0x73e6f)
>     #4 0xaaab42fb58e7 in configure_accelerators /qemu/vl.c:2777
>     #5 0xaaab42fb58e7 in main /qemu/vl.c:4121
>     #6 0xffff8f9b0b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
>     #7 0xaaab42fc1dab  (/qemu/build/aarch64-softmmu/qemu-system-aarch64+0x8b1dab)
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
>  vl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/vl.c b/vl.c
> index 86474a55c9..035a24e52b 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2788,6 +2788,7 @@ static void configure_accelerators(const char *progname)
>                  error_report("invalid accelerator %s", *tmp);
>              }
>          }
> +        g_strfreev(accel_list);
>      } else {
>          if (accel != NULL) {
>              error_report("The -accel and \"-machine accel=\" options are incompatible");
> 

Applied to my trivial-patches branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-08 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 11:42 [PATCH] vl: fix memory leak in configure_accelerators kuhn.chenqun
2020-01-08 14:56 ` Philippe Mathieu-Daudé
2020-01-08 14:59   ` Paolo Bonzini
2020-01-08 15:13 ` Laurent Vivier

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).