[uClibc-cvs] uClibc/utils ldd.c,1.7,1.8

Erik Andersen andersen at uclibc.org
Fri Feb 13 10:56:45 UTC 2004


Update of /var/cvs/uClibc/utils
In directory nail:/tmp/cvs-serv27209

Modified Files:
	ldd.c 
Log Message:
A better fix...


Index: ldd.c
===================================================================
RCS file: /var/cvs/uClibc/utils/ldd.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ldd.c	13 Feb 2004 10:52:41 -0000	1.7
+++ ldd.c	13 Feb 2004 10:56:43 -0000	1.8
@@ -281,7 +281,7 @@
 
 	/* If this is a fully resolved name, our job is easy */
 	if (stat (lib->name, &filestat) == 0) {
-		lib->path = lib->name;
+		lib->path = strdup(lib->name);
 		return;
 	}
 
@@ -470,7 +470,7 @@
 			return NULL;
 		newlib->name = malloc(strlen(s)+1);
 		strcpy(newlib->name, s);
-		newlib->path = newlib->name;
+		newlib->path = strdup(newlib->name);
 		newlib->resolved = 1;
 		newlib->next = NULL;
 
@@ -664,14 +664,12 @@
 			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) {
 				free(cur->path);
 				cur->path=NULL;
 			}
-			if (cur->name) {
-				free(cur->name);
-				cur->name=NULL;
-			}
 		}
 		lib_list=NULL;
 	}




More information about the uClibc-cvs mailing list