[PATCH] lib: fwts_pipeio: handle realloc failure
Keng-Yü Lin
kengyu at canonical.com
Fri Mar 9 05:35:49 UTC 2012
On Fri, Mar 9, 2012 at 9:10 AM, Colin King <colin.king at canonical.com> 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;
> --
> 1.7.9
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>
More information about the fwts-devel
mailing list