[PATCH] lib: fwts_pipeio: handle realloc failure

Alex Hung alex.hung at canonical.com
Fri Mar 9 01:45:44 UTC 2012


On 03/09/2012 09:10 AM, Colin King wrote:
> From: Colin Ian King<colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king at canonical.com>
> ---
>   src/lib/src/fwts_pipeio.c |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
> index 7577beb..d4abfd5 100644
> --- a/src/lib/src/fwts_pipeio.c
> +++ b/src/lib/src/fwts_pipeio.c
> @@ -98,6 +98,8 @@ char *fwts_pipe_read(const int fd, ssize_t *length)
>   		}
>   		else {
>   			ptr = realloc(ptr, size + n + 1);
> +			if (ptr == NULL)
> +				return NULL;
>   			memcpy(ptr + size, buffer, n);
>   			size += n;
>   			*(ptr+size) = 0;
Acked-by: Alex Hung <alex.hung at canonical.com>




More information about the fwts-devel mailing list