diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-18 08:55:23 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-18 08:55:23 +0000 |
| commit | 1dfdc15bb0126487cd2784f4a42a5d3598b21f7c (patch) | |
| tree | 7fc7f07db9e35a3b666f265dc0bf57e5ecb0d5ee /libexec/rtld-elf/arm | |
| parent | f8c5fbf7c16623493822a4b4942d3600ffcd011c (diff) | |
Notes
Diffstat (limited to 'libexec/rtld-elf/arm')
| -rw-r--r-- | libexec/rtld-elf/arm/reloc.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c index e383892ee3a58..6ad80fd82dfc3 100644 --- a/libexec/rtld-elf/arm/reloc.c +++ b/libexec/rtld-elf/arm/reloc.c @@ -245,7 +245,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld) const Elf_Rel *rellim; const Elf_Rel *rel; SymCache *cache; - int bytes = obj->nchains * sizeof(SymCache); int r = -1; /* The relocation for the dynamic loader has already been done. */ @@ -255,10 +254,9 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld) * The dynamic loader may be called from a thread, we have * limited amounts of stack available so we cannot use alloca(). */ - 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 */ + rellim = (const Elf_Rel *)((caddr_t)obj->rel + obj->relsize); for (rel = obj->rel; rel < rellim; rel++) { if (reloc_nonplt_object(obj, rel, cache) < 0) @@ -266,9 +264,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); } |
