[igt-dev] [PATCH i-g-t] runner: Fix a memory leak in stderr_contains_warnings

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Nov 14 14:03:22 UTC 2022


Hi,

On 2022-11-11 at 10:05:29 +0200, Petri Latvala wrote:
> The matches object's internals weren't released.
> 
> Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> Cc: Arkadiusz Hiler <arek at hiler.eu>
> Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
>  runner/resultgen.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/runner/resultgen.c b/runner/resultgen.c
> index 3d753828..21a3ed84 100644
> --- a/runner/resultgen.c
> +++ b/runner/resultgen.c
> @@ -1912,6 +1912,8 @@ static bool stderr_contains_warnings(const char *beg, const char *end)
>  		i++;
>  	}
>  
> +	free_matches(&matches);
> +
>  	return false;

On second look you need to free it also before return true ?
So maybe reformat it, use break and then 'return found;' ?

Regards,
Kamil

>  }
>  
> -- 
> 2.30.2
> 


More information about the igt-dev mailing list