ACK: [PATCH] lib: fwts_log_json: fix memory leak

ivanhu ivan.hu at canonical.com
Tue Aug 25 02:34:54 UTC 2020



On 8/24/20 5:30 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> The string str is not being free'd after use, leading to a memory
> leak. Free it.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/src/fwts_log_json.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_log_json.c b/src/lib/src/fwts_log_json.c
> index 1a917e63..7bb5110a 100644
> --- a/src/lib/src/fwts_log_json.c
> +++ b/src/lib/src/fwts_log_json.c
> @@ -211,7 +211,7 @@ static void fwts_log_open_json(fwts_log_file *log_file)
>  
>  static void fwts_log_close_json(fwts_log_file *log_file)
>  {
> -	const char *str;
> +	char *str;
>  
>  	fwts_log_section_end_json(log_file);
>  
> @@ -233,6 +233,7 @@ static void fwts_log_close_json(fwts_log_file *log_file)
>  		log_file->line_number++;
>  	}
>  	json_object_put(json_stack[0].obj);
> +	free(str);
>  }
>  
>  fwts_log_ops fwts_log_json_ops = {
> 


Acked-by: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list