]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Correctly free name in expand_variable
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 12 Jul 2011 19:30:01 +0000 (21:30 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 12 Jul 2011 19:30:01 +0000 (21:30 +0200)
util.c

diff --git a/util.c b/util.c
index 3a32411b7f522f9d477ecbf3802d071e18bbc424..810ccc7fb446c2f2913a48f8f6e5e7ad6be9d7a8 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1316,6 +1316,7 @@ expand_variable(const char **str, char **result, char **errmsg)
        value = getenv(name);
        if (!value) {
                *errmsg = format("environment variable \"%s\" not set", name);
+               free(name);
                return false;
        }
        x_asprintf2(result, "%s%s", *result, value);
@@ -1323,6 +1324,7 @@ expand_variable(const char **str, char **result, char **errmsg)
                --q;
        }
        *str = q;
+       free(name);
        return true;
 }