summaryrefslogtreecommitdiff
path: root/masm/asm.c
diff options
context:
space:
mode:
Diffstat (limited to 'masm/asm.c')
-rw-r--r--masm/asm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/masm/asm.c b/masm/asm.c
index 30628ec..328ae16 100644
--- a/masm/asm.c
+++ b/masm/asm.c
@@ -315,7 +315,7 @@ static int assemble_phdr(struct assembler *assembler, Elf32_Phdr **res,
Elf32_Phdr *phdr = malloc(sizeof(Elf32_Phdr) *
assembler->sectab.len);
if (phdr == NULL) {
- ERROR("cannot alloc");
+ PERROR("cannot alloc");
return M_ERROR;;
}
@@ -354,6 +354,11 @@ static int assemble_shdr(struct assembler *assembler, Elf32_Shdr **res,
Elf32_Shdr *shdr = malloc(sizeof(Elf32_Shdr) * max_entries);
+ if (shdr == NULL) {
+ PERROR("cannot alloc");
+ return M_ERROR;
+ }
+
size_t str_off;
uint32_t count = 0;
@@ -593,7 +598,7 @@ static int write_file(struct assembler *assembler, Elf32_Ehdr *ehdr,
if (out == NULL)
{
- ERROR("cannot write '%s'", path);
+ PERROR("cannot write '%s'", path);
return M_ERROR;
}