ACK: [PATCH 05/10] lib: fwts_formatting: fix memory leak

IvanHu ivan.hu at canonical.com
Tue May 6 03:11:11 UTC 2014


On 05/01/2014 10:01 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Coverity Scan detected a memory leak with tidied_text
> on the NULL return path, so free this before we return.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_formatting.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/lib/src/fwts_formatting.c b/src/lib/src/fwts_formatting.c
> index ffc9601..555722e 100644
> --- a/src/lib/src/fwts_formatting.c
> +++ b/src/lib/src/fwts_formatting.c
> @@ -117,6 +117,7 @@ fwts_list *fwts_format_text(const char *text, const int width)
>   			if (lastspace != NULL) {
>   				if ((tmp = dup_line(linestart, lastspace, width)) == NULL) {
>   					fwts_text_list_free(list);
> +					free(tidied_text);
>   					return NULL;
>   				}
>   				fwts_text_list_append(list, tmp);
> @@ -132,6 +133,7 @@ fwts_list *fwts_format_text(const char *text, const int width)
>   	}
>   	if ((tmp = dup_line(linestart, textptr, width)) == NULL) {
>   		fwts_text_list_free(list);
> +		free(tidied_text);
>   		return NULL;
>   	}
>   	fwts_text_list_append(list, tmp);
>

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



More information about the fwts-devel mailing list