diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-02-13 11:11:10 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-02-13 11:11:10 +0000 |
commit | 7bd4a2f4aaabca0e46015fe0216c086c7f61f1d4 (patch) | |
tree | 2e9481883f1389ff2f9397bb936a37a2e3b937c4 /utils/ldd.c | |
parent | 4eaa2fd3d1c7e85258d1e2b22cc60686e638de5a (diff) | |
download | uClibc-alpine-7bd4a2f4aaabca0e46015fe0216c086c7f61f1d4.tar.bz2 uClibc-alpine-7bd4a2f4aaabca0e46015fe0216c086c7f61f1d4.tar.xz |
Yet more fixups..
Diffstat (limited to 'utils/ldd.c')
-rw-r--r-- | utils/ldd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/utils/ldd.c b/utils/ldd.c index 08e66831f..537316452 100644 --- a/utils/ldd.c +++ b/utils/ldd.c @@ -462,6 +462,7 @@ static struct library * find_elf_interpreter(Elf32_Ehdr* ehdr) free(newlib->name); if (newlib->path != not_found) { free(newlib->path); + } newlib->name = NULL; newlib->path = NULL; return NULL; @@ -516,7 +517,7 @@ int find_dependancies(char* filename) } if (fstat(fileno(thefile), &statbuf) < 0) { perror(filename); - flose(thefile); + fclose(thefile); return -1; } @@ -529,9 +530,14 @@ int find_dependancies(char* filename) /* mmap the file to make reading stuff from it effortless */ ehdr = (Elf32_Ehdr *)mmap(0, statbuf.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(thefile), 0); + if (ehdr == MAP_FAILED) { + fclose(thefile); + fprintf(stderr, "Out of memory!\n"); + return -1; + } foo: - flose(thefile); + fclose(thefile); /* Check if this looks like a legit ELF file */ if (check_elf_header(ehdr)) { |