summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-02-13 09:51:32 +0000
committerEric Andersen <andersen@codepoet.org>2004-02-13 09:51:32 +0000
commit6eec2e331f9ce8aa90171da3df27c82b08fc3ac7 (patch)
tree295bfe76a17aa3e2a6797518f2d431b2362a61a1 /utils
parent1218c09543a4a231130f2a84a57d1364a2f8914b (diff)
Avoid potential double free when locate_library_file() is used
on fully resolved names
Diffstat (limited to 'utils')
-rw-r--r--utils/ldd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/utils/ldd.c b/utils/ldd.c
index 6569c204a..9e9e08d36 100644
--- a/utils/ldd.c
+++ b/utils/ldd.c
@@ -669,11 +669,14 @@ int main( int argc, char** argv)
printf("\tnot a dynamic executable\n");
for (cur = lib_list; cur; cur=cur->next) {
- free(cur->name);
- cur->name=NULL;
- if (cur->path && cur->path != not_found)
+ if (cur->path && cur->path != not_found) {
free(cur->path);
- cur->path=NULL;
+ cur->path=NULL;
+ }
+ if (cur->name) {
+ free(cur->name);
+ cur->name=NULL;
+ }
}
lib_list=NULL;
}