From patchwork Fri Mar 9 01:10:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: lib: fwts_pipeio: handle realloc failure Date: Thu, 08 Mar 2012 15:10:37 -0000 From: Colin King X-Patchwork-Id: 145640 Message-Id: <1331255437-31104-1-git-send-email-colin.king@canonical.com> To: fwts-devel@lists.ubuntu.com From: Colin Ian King Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Keng-Yu Lin --- 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;