aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-01-15 14:57:45 +0000
committerMatt Fleming <matt.fleming@intel.com>2013-01-16 12:22:42 +0000
commit8deea7fccbf76bca2ec62057afc774540da1603e (patch)
tree8620c8414b01713e762584706191eb66df3492fe
parentab06ca87afc01c1146a878989524eef03f331d7e (diff)
downloadsyslinux-8deea7fccbf76bca2ec62057afc774540da1603e.tar.gz
syslinux-8deea7fccbf76bca2ec62057afc774540da1603e.tar.xz
syslinux-8deea7fccbf76bca2ec62057afc774540da1603e.zip
module: Check return value of malloc()
And return NULL after printing an appropriate error message if the call failed. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/lib/sys/module/common.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/com32/lib/sys/module/common.c b/com32/lib/sys/module/common.c
index d72dd702..deb2bcc8 100644
--- a/com32/lib/sys/module/common.c
+++ b/com32/lib/sys/module/common.c
@@ -185,6 +185,11 @@ void modules_term(void) {
struct elf_module *module_alloc(const char *name) {
struct elf_module *result = malloc(sizeof(struct elf_module));
+ if (!result) {
+ dprintf("module: Failed to alloc elf_module\n");
+ return NULL;
+ }
+
memset(result, 0, sizeof(struct elf_module));
INIT_LIST_HEAD(&result->list);