Reviewed-by: Claudio Fontana <cfont...@suse.de>
On 8/12/24 10:57, Alexander Ivanov wrote:
> Move local_err initialization inside the loop in the module_load_qom_all()
> function. This change ensures that the error variable is reset to NULL for
> each iteration of the loop. This prevents triggering assert(*errp == NULL)
> failure in error_setv() when local_err is reused in the loop.
>
> Note: The local_err variable is freed in error_report_err() so there is no
> any leak.
>
> Signed-off-by: Alexander Ivanov <alexander.iva...@virtuozzo.com>
> ---
> util/module.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/util/module.c b/util/module.c
> index 32e263163c..3eb0f06df1 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;
> }