From: Joel Rosdahl Date: Fri, 30 Jul 2010 19:48:28 +0000 (+0200) Subject: Plug some minor memory leaks X-Git-Tag: v3.1~132 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e0f47527530ad7e690cd7d28a94ac35f2f62a338;p=thirdparty%2Fccache.git Plug some minor memory leaks --- diff --git a/ccache.c b/ccache.c index c0200462a..e9d291275 100644 --- a/ccache.c +++ b/ccache.c @@ -1472,6 +1472,7 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args, if (i < argc - 1) { if (strcmp(argv[i], "-MF") == 0) { dependency_filename_specified = 1; + free(output_dep); output_dep = make_relative_path(x_strdup(argv[i + 1])); args_add(dep_args, argv[i]); args_add(dep_args, argv[i + 1]); @@ -1489,6 +1490,7 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args, if (strncmp(argv[i], "-Wp,-MD,", 8) == 0 && !strchr(argv[i] + 8, ',')) { generating_dependencies = 1; dependency_filename_specified = 1; + free(output_dep); output_dep = make_relative_path(x_strdup(argv[i] + 8)); args_add(dep_args, argv[i]); continue; @@ -1496,6 +1498,7 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args, && !strchr(argv[i] + 9, ',')) { generating_dependencies = 1; dependency_filename_specified = 1; + free(output_dep); output_dep = make_relative_path(x_strdup(argv[i] + 9)); args_add(dep_args, argv[i]); continue; diff --git a/test/main.c b/test/main.c index 1d39bfcae..f5eaef4a2 100644 --- a/test/main.c +++ b/test/main.c @@ -86,5 +86,6 @@ int main(int argc, char **argv) cct_wipe(testdir); } free(testdir); + free(dir_before); return result; } diff --git a/util.c b/util.c index 2455748b5..3667d3f99 100644 --- a/util.c +++ b/util.c @@ -883,7 +883,7 @@ const char *get_home_directory(void) /* * Get the current directory by reading $PWD. If $PWD isn't sane, gnu_getcwd() - * is used. + * is used. Caller frees. */ char *get_cwd(void) {