Re: [PATCH] util/module: fix a memory leak
Le 20/12/2019 à 08:37, Markus Armbruster a écrit : > Cc: qemu-trivial > > writes: > >> From: Pan Nengyuan >> >> spotted by ASAN >> >> Fixes: 81d8ccb1bea4fb9eaaf4c8e30bd4021180a9a39f >> Reported-by: Euler Robot >> Signed-off-by: Pan Nengyuan >> --- >> 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 > > 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
Re: [PATCH] util/module: fix a memory leak
Cc: qemu-trivial writes: > From: Pan Nengyuan > > spotted by ASAN > > Fixes: 81d8ccb1bea4fb9eaaf4c8e30bd4021180a9a39f > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan > --- > 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 Reviewing this made me wonder: @loaded_modules is global state, but there appears to be no synchronization. What's the safety argument?
[PATCH] util/module: fix a memory leak
From: Pan Nengyuan spotted by ASAN Fixes: 81d8ccb1bea4fb9eaaf4c8e30bd4021180a9a39f Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- 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