[PATCH] lib: fwts_acpi_tables: handle fwts_low_realloc() failures
Colin King
colin.king at canonical.com
Fri Mar 9 01:04:18 UTC 2012
From: Colin Ian King <colin.king at canonical.com>
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_acpi_tables.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
index 5b8887b..0a90d37 100644
--- a/src/lib/src/fwts_acpi_tables.c
+++ b/src/lib/src/fwts_acpi_tables.c
@@ -349,6 +349,8 @@ static uint8_t *fwts_acpi_load_table_from_acpidump(FILE *fp, char *name, uint64_
len += (n - 1);
table = fwts_low_realloc(table, len);
+ if (table == NULL)
+ return NULL;
memcpy(table + offset, data, n-1);
}
@@ -414,6 +416,8 @@ static uint8_t *fwts_acpi_load_table_from_file(const int fd, size_t *length)
}
else {
ptr = (uint8_t*)fwts_low_realloc(ptr, size + n + 1);
+ if (ptr == NULL)
+ return NULL;
memcpy(ptr + size, buffer, n);
size += n;
}
--
1.7.9
More information about the fwts-devel
mailing list