summaryrefslogtreecommitdiff
path: root/masm/asm.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-09-22 16:02:42 -0400
committerFreya Murphy <freya@freyacat.org>2024-09-22 16:02:42 -0400
commit85471efb4c740bb775c9ebdb10f775620c979598 (patch)
treec4afa5cf8108df4192e73488c4da271ed166217c /masm/asm.c
parentupdate make clear (diff)
downloadmips-85471efb4c740bb775c9ebdb10f775620c979598.tar.gz
mips-85471efb4c740bb775c9ebdb10f775620c979598.tar.bz2
mips-85471efb4c740bb775c9ebdb10f775620c979598.zip
mld done
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;
}