]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
x_strdup() path in find_executable_in_path() instead of in find_executable()
authorRamiro Polla <ramiro.polla@gmail.com>
Thu, 15 Jul 2010 17:43:32 +0000 (14:43 -0300)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 16 Jul 2010 13:51:59 +0000 (15:51 +0200)
find_executable_in_path() now only frees the memory it has allocated itself.

execute.c

index f441402cc742030a6f7f9a79d7a12383d940d1f6..50e96b1430a09b3b7147225ce8a0b94b3d081f17 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -103,8 +103,6 @@ char *find_executable(const char *name, const char *exclude_name)
                return NULL;
        }
 
-       path = x_strdup(path);
-
        return find_executable_in_path(name, exclude_name, path);
 }
 
@@ -113,6 +111,8 @@ find_executable_in_path(const char *name, const char *exclude_name, char *path)
 {
        char *tok;
 
+       path = x_strdup(path);
+
        /* search the path looking for the first compiler of the right name
           that isn't us */
        for (tok=strtok(path,":"); tok; tok = strtok(NULL, ":")) {