mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-04-12 18:40:23 +08:00
outmac64.c: Fix memory clobber bug, clean up memory free
Fix an array that was way too small resulting in memory overwrite errors, and free a few more dynamic data structures. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
97577e82d7
commit
f30d96d1c0
@ -1016,7 +1016,7 @@ static void macho_calculate_sizes (void)
|
||||
}
|
||||
|
||||
/* Create a table of sections by file index to avoid linear search */
|
||||
sectstab = nasm_malloc(seg_nsects64 + 1);
|
||||
sectstab = nasm_malloc((seg_nsects64 + 1) * sizeof(*sectstab));
|
||||
sectstab[0] = NULL;
|
||||
for (s = sects, fi = 1; s != NULL; s = s->next, fi++)
|
||||
sectstab[fi] = s;
|
||||
@ -1456,14 +1456,15 @@ static void macho_cleanup(int debuginfo)
|
||||
saa_free(strs);
|
||||
raa_free(extsyms);
|
||||
|
||||
if (syms) {
|
||||
while (syms->next) {
|
||||
while (syms) {
|
||||
sym = syms;
|
||||
syms = syms->next;
|
||||
|
||||
nasm_free (sym);
|
||||
}
|
||||
}
|
||||
|
||||
nasm_free(extdefsyms);
|
||||
nasm_free(undefsyms);
|
||||
nasm_free(sectstab);
|
||||
}
|
||||
|
||||
/* Debugging routines. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user