]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix minor memory leaks
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 4 Feb 2015 20:17:17 +0000 (21:17 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 19 Apr 2015 11:31:57 +0000 (13:31 +0200)
ccache.c

index c0c6d51f5e437fd111e26950fd0be92f082d4152..46bee3082e195ddbd18e592127523634244ee43b 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1275,10 +1275,14 @@ calculate_common_hash(struct args *args, struct mdfour *hash)
                if (profile_dir) {
                        dir = x_strdup(profile_dir);
                } else {
-                       dir = x_realpath(dir);
+                       char *real_dir = x_realpath(dir);
+                       free(dir);
+                       dir = real_dir;
                }
                if (dir) {
-                       p = remove_extension(basename(output_obj));
+                       char *base_name = basename(output_obj);
+                       p = remove_extension(base_name);
+                       free(base_name);
                        gcda_path = format("%s/%s.gcda", dir, p);
                        cc_log("Hashing coverage path %s", gcda_path);
                        free(p);