Message ID | 1331255177-30632-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 03/09/2012 09:06 AM, Colin King wrote: > From: Colin Ian King<colin.king@canonical.com> > > Signed-off-by: Colin Ian King<colin.king@canonical.com> > --- > src/lib/src/fwts_acpid.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/src/lib/src/fwts_acpid.c b/src/lib/src/fwts_acpid.c > index caaf157..6952276 100644 > --- a/src/lib/src/fwts_acpid.c > +++ b/src/lib/src/fwts_acpid.c > @@ -103,6 +103,8 @@ char *fwts_acpi_event_read(const int fd, size_t *length, const int timeout) > } > 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@canonical.com>
On Fri, Mar 9, 2012 at 9:06 AM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_acpid.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/src/lib/src/fwts_acpid.c b/src/lib/src/fwts_acpid.c > index caaf157..6952276 100644 > --- a/src/lib/src/fwts_acpid.c > +++ b/src/lib/src/fwts_acpid.c > @@ -103,6 +103,8 @@ char *fwts_acpi_event_read(const int fd, size_t *length, const int timeout) > } > 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@canonical.com>
diff --git a/src/lib/src/fwts_acpid.c b/src/lib/src/fwts_acpid.c index caaf157..6952276 100644 --- a/src/lib/src/fwts_acpid.c +++ b/src/lib/src/fwts_acpid.c @@ -103,6 +103,8 @@ char *fwts_acpi_event_read(const int fd, size_t *length, const int timeout) } else { ptr = realloc(ptr, size + n + 1); + if (ptr == NULL) + return NULL; memcpy(ptr + size, buffer, n); size += n; *(ptr+size) = 0;