ACK: [PATCH 01/10] lib: fwts_acpi_tables: fix memory leak on error exit path

IvanHu ivan.hu at canonical.com
Tue May 6 02:49:44 UTC 2014


On 05/01/2014 10:01 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Forgot to free the hdr if the hdr length is too small.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_acpi_tables.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index e40583e..d6ab1ce 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -172,8 +172,10 @@ static void *fwts_acpi_load_table(const off_t addr)
>   		return NULL;
>
>   	len = hdr->length;
> -	if (len < (int)sizeof(fwts_acpi_table_header))
> +	if (len < (int)sizeof(fwts_acpi_table_header)) {
> +		(void)fwts_munmap(hdr, sizeof(fwts_acpi_table_header));
>   		return NULL;
> +	}
>
>   	(void)fwts_munmap(hdr, sizeof(fwts_acpi_table_header));
>
>

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



More information about the fwts-devel mailing list