]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix potential free() of non-heap memory
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 14 Aug 2011 17:35:24 +0000 (19:35 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 14 Aug 2011 17:35:24 +0000 (19:35 +0200)
ccache.c

index 92233138dfa8b001951e3f1fa0a58d3e9b2b0357..339ce5fe6db2c67b81a49f76f01f4693b7ef73e8 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1599,7 +1599,7 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args,
                }
 
                if (str_startswith(argv[i], "-fprofile-")) {
-                       char* arg_profile_dir = strchr(argv[i], '=');
+                       const char* arg_profile_dir = strchr(argv[i], '=');
                        char* arg = x_strdup(argv[i]);
                        bool supported_profile_option = false;
 
@@ -1642,7 +1642,7 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args,
                                        goto out;
                                } else if (arg_profile_dir) {
                                        cc_log("Setting profile directory to %s", profile_dir);
-                                       profile_dir = arg_profile_dir;
+                                       profile_dir = x_strdup(arg_profile_dir);
                                }
                                continue;
                        }