Index: config/gen/platform/darwin/dl.c
===================================================================
--- config/gen/platform/darwin/dl.c	(revision 9483)
+++ config/gen/platform/darwin/dl.c	(working copy)
@@ -20,24 +20,25 @@
     static char buf[PATH_MAX];
     struct stat st;
     char *path_list;
+    char *path_list_start;
     const char *path;
 
     if(!libpath)
 	return NULL;
 
-    path_list = strdup(libpath);
+    path_list_start = path_list = strdup(libpath);
 
     path = strsep(&path_list, ":");
 
     while(path) {
 	snprintf(buf, PATH_MAX, "%s/%s", path, filename);
 	if(stat(buf, &st) == 0) {
-	    free(path_list);
+	    free(path_list_start);
 	    return buf;
 	}
 	path = strsep(&path_list, ":");
     }
-    free(path_list);
+    free(path_list_start);
     return NULL;
 }
 
