ACK: [PATCH] lib: fwts_gpe: fix double free on gpe buffer

Alex Hung alex.hung at canonical.com
Sat Apr 22 15:00:31 UTC 2017


On 2017-04-21 02:24 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> My previous memory leak fix introduced a double free bug, fix this by
> not free'ing the buffer twice.  Issue detected by CoverityScan.
>
> Fixes: 5a4034ff7938 ("lib: fwts_gpe: free original gpe buffer on failed realloc")
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/src/fwts_gpe.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_gpe.c b/src/lib/src/fwts_gpe.c
> index a16fee86..2b3db0f5 100644
> --- a/src/lib/src/fwts_gpe.c
> +++ b/src/lib/src/fwts_gpe.c
> @@ -66,7 +66,6 @@ int fwts_gpe_read(fwts_gpe **gpes)
>
>  			tmp = realloc(*gpes, sizeof(fwts_gpe) * (n+1));
>  			if (!tmp) {
> -				free(*gpes);
>  				goto error;
>  			} else {
>  				char path[PATH_MAX];
>

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list