From: Alexander Ivanov <[email protected]>

Set local_err to NULL after it has been freed in error_report_err(). This
avoids triggering assert(*errp == NULL) failure in error_setv() when
local_err is reused in the loop.

Signed-off-by: Alexander Ivanov <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Reviewed-by: Denis V. Lunev <[email protected]>
Link: 
https://lore.kernel.org/r/[email protected]
[Do the same by moving the declaration instead. - Paolo]
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
---
 util/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/module.c b/util/module.c
index 32e263163c7..3eb0f06df16 100644
--- a/util/module.c
+++ b/util/module.c
@@ -354,13 +354,13 @@ int module_load_qom(const char *type, Error **errp)
 void module_load_qom_all(void)
 {
     const QemuModinfo *modinfo;
-    Error *local_err = NULL;
 
     if (module_loaded_qom_all) {
         return;
     }
 
     for (modinfo = module_info; modinfo->name != NULL; modinfo++) {
+        Error *local_err = NULL;
         if (!modinfo->objs) {
             continue;
         }
-- 
2.46.0


Reply via email to