summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf/powerpc/reloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/rtld-elf/powerpc/reloc.c')
-rw-r--r--libexec/rtld-elf/powerpc/reloc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c
index ccdcd90..c90852f 100644
--- a/libexec/rtld-elf/powerpc/reloc.c
+++ b/libexec/rtld-elf/powerpc/reloc.c
@@ -287,7 +287,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
const Elf_Rela *relalim;
const Elf_Rela *rela;
SymCache *cache;
- int bytes = obj->nchains * sizeof(SymCache);
int r = -1;
/*
@@ -295,10 +294,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
* limited amounts of stack available so we cannot use alloca().
*/
if (obj != obj_rtld) {
- cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON,
- -1, 0);
- if (cache == MAP_FAILED)
- cache = NULL;
+ cache = calloc(obj->nchains, sizeof(SymCache));
+ /* No need to check for NULL here */
} else
cache = NULL;
@@ -314,9 +311,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
}
r = 0;
done:
- if (cache) {
- munmap(cache, bytes);
- }
+ if (cache != NULL)
+ free(cache);
return (r);
}
OpenPOWER on IntegriCloud