qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] util/module: fix a memory leak
@ 2019-12-20  1:34 pannengyuan
  2019-12-20  7:37 ` Markus Armbruster
  0 siblings, 1 reply; 3+ messages in thread
From: pannengyuan @ 2019-12-20  1:34 UTC (permalink / raw)
  To: pbonzini, marcandre.lureau, armbru
  Cc: Pan Nengyuan, zhang.zhanghailiang, qemu-devel

From: Pan Nengyuan <pannengyuan@huawei.com>

spotted by ASAN

Fixes: 81d8ccb1bea4fb9eaaf4c8e30bd4021180a9a39f
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
 util/module.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/util/module.c b/util/module.c
index e9fe3e5..8c5315a 100644
--- a/util/module.c
+++ b/util/module.c
@@ -214,6 +214,7 @@ bool module_load_one(const char *prefix, const char *lib_name)
 
     if (!success) {
         g_hash_table_remove(loaded_modules, module_name);
+        g_free(module_name);
     }
 
     for (i = 0; i < n_dirs; i++) {
-- 
2.7.2.windows.1




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

* Re: [PATCH] util/module: fix a memory leak
  2019-12-20  1:34 [PATCH] util/module: fix a memory leak pannengyuan
@ 2019-12-20  7:37 ` Markus Armbruster
  2019-12-20  7:55   ` Laurent Vivier
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Armbruster @ 2019-12-20  7:37 UTC (permalink / raw)
  To: pannengyuan
  Cc: qemu-devel, pbonzini, qemu-trivial, zhang.zhanghailiang,
	marcandre.lureau

Cc: qemu-trivial

<pannengyuan@huawei.com> writes:

> From: Pan Nengyuan <pannengyuan@huawei.com>
>
> spotted by ASAN
>
> Fixes: 81d8ccb1bea4fb9eaaf4c8e30bd4021180a9a39f
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> ---
>  util/module.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/util/module.c b/util/module.c
> index e9fe3e5..8c5315a 100644
> --- a/util/module.c
> +++ b/util/module.c
> @@ -214,6 +214,7 @@ bool module_load_one(const char *prefix, const char *lib_name)
>  
>      if (!success) {
>          g_hash_table_remove(loaded_modules, module_name);
> +        g_free(module_name);
>      }
>  
>      for (i = 0; i < n_dirs; i++) {

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

Reviewing this made me wonder: @loaded_modules is global state, but
there appears to be no synchronization.  What's the safety argument?



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

* Re: [PATCH] util/module: fix a memory leak
  2019-12-20  7:37 ` Markus Armbruster
@ 2019-12-20  7:55   ` Laurent Vivier
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2019-12-20  7:55 UTC (permalink / raw)
  To: Markus Armbruster, pannengyuan
  Cc: qemu-trivial, pbonzini, qemu-devel, marcandre.lureau,
	zhang.zhanghailiang

Le 20/12/2019 à 08:37, Markus Armbruster a écrit :
> Cc: qemu-trivial
> 
> <pannengyuan@huawei.com> writes:
> 
>> From: Pan Nengyuan <pannengyuan@huawei.com>
>>
>> spotted by ASAN
>>
>> Fixes: 81d8ccb1bea4fb9eaaf4c8e30bd4021180a9a39f
>> Reported-by: Euler Robot <euler.robot@huawei.com>
>> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
>> ---
>>  util/module.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/util/module.c b/util/module.c
>> index e9fe3e5..8c5315a 100644
>> --- a/util/module.c
>> +++ b/util/module.c
>> @@ -214,6 +214,7 @@ bool module_load_one(const char *prefix, const char *lib_name)
>>  
>>      if (!success) {
>>          g_hash_table_remove(loaded_modules, module_name);
>> +        g_free(module_name);
>>      }
>>  
>>      for (i = 0; i < n_dirs; i++) {
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> 
> Reviewing this made me wonder: @loaded_modules is global state, but
> there appears to be no synchronization.  What's the safety argument?
> 
> 

Applied to my trivial-patches branch.

Thanks,
Laurent


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

end of thread, other threads:[~2019-12-20  7:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-20  1:34 [PATCH] util/module: fix a memory leak pannengyuan
2019-12-20  7:37 ` Markus Armbruster
2019-12-20  7:55   ` 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).