summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-02-13 11:05:36 +0000
committerEric Andersen <andersen@codepoet.org>2004-02-13 11:05:36 +0000
commit4eaa2fd3d1c7e85258d1e2b22cc60686e638de5a (patch)
tree54bab25e930614f40e67fae1aaabd94b705d31d2
parentbc237c25845678360e3ce3bd47d880ad85138da6 (diff)
Done free path if it equals not_found
Remember to flose an fopened file
-rw-r--r--utils/ldd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/ldd.c b/utils/ldd.c
index 5accdc767..08e66831f 100644
--- a/utils/ldd.c
+++ b/utils/ldd.c
@@ -460,7 +460,8 @@ static struct library * find_elf_interpreter(Elf32_Ehdr* ehdr)
//printf("find_elf_interpreter is replacing '%s' (already in list)\n", cur->name);
newlib = cur;
free(newlib->name);
- free(newlib->path);
+ if (newlib->path != not_found) {
+ free(newlib->path);
newlib->name = NULL;
newlib->path = NULL;
return NULL;
@@ -515,6 +516,7 @@ int find_dependancies(char* filename)
}
if (fstat(fileno(thefile), &statbuf) < 0) {
perror(filename);
+ flose(thefile);
return -1;
}
@@ -529,6 +531,8 @@ int find_dependancies(char* filename)
PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(thefile), 0);
foo:
+ flose(thefile);
+
/* Check if this looks like a legit ELF file */
if (check_elf_header(ehdr)) {
fprintf(stderr, "%s: not an ELF file.\n", filename);