diff options
Diffstat (limited to 'libexec/rtld-elf/sparc64')
-rw-r--r-- | libexec/rtld-elf/sparc64/reloc.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/libexec/rtld-elf/sparc64/reloc.c b/libexec/rtld-elf/sparc64/reloc.c index 23b73dd..1b8f1fd 100644 --- a/libexec/rtld-elf/sparc64/reloc.c +++ b/libexec/rtld-elf/sparc64/reloc.c @@ -254,7 +254,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; /* @@ -262,10 +261,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; @@ -276,8 +273,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); } |