aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
Diffstat (limited to 'com32')
-rw-r--r--com32/lib/sys/module/elf_module.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/com32/lib/sys/module/elf_module.c b/com32/lib/sys/module/elf_module.c
index 24da2209..c4e9d410 100644
--- a/com32/lib/sys/module/elf_module.c
+++ b/com32/lib/sys/module/elf_module.c
@@ -67,6 +67,9 @@ static int load_segments(struct elf_module *module, Elf32_Ehdr *elf_hdr) {
// Load the PHT
pht = malloc(elf_hdr->e_phnum * elf_hdr->e_phentsize);
+ if (!pht)
+ return -1;
+
image_read(pht, elf_hdr->e_phnum * elf_hdr->e_phentsize, module);
// Compute the memory needings of the module
@@ -170,6 +173,11 @@ static int load_segments(struct elf_module *module, Elf32_Ehdr *elf_hdr) {
// Load the SHT
sht = malloc(elf_hdr->e_shnum * elf_hdr->e_shentsize);
+ if (!sht) {
+ res = -1;
+ goto out;
+ }
+
image_read(sht, elf_hdr->e_shnum * elf_hdr->e_shentsize, module);
// Setup the symtable size