diff --git a/bisect.c b/bisect.c index 48acf73391..1aad49b1a6 100644 --- a/bisect.c +++ b/bisect.c @@ -833,7 +833,7 @@ static int check_ancestors(const char *prefix) */ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout) { - char *filename = xstrdup(git_path("BISECT_ANCESTORS_OK")); + char *filename = git_pathdup("BISECT_ANCESTORS_OK"); struct stat st; int fd; diff --git a/builtin/add.c b/builtin/add.c index 89dce56a24..2fc2677422 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -260,7 +260,7 @@ int interactive_add(int argc, const char **argv, const char *prefix, int patch) static int edit_patch(int argc, const char **argv, const char *prefix) { - char *file = xstrdup(git_path("ADD_EDIT.patch")); + char *file = git_pathdup("ADD_EDIT.patch"); const char *apply_argv[] = { "apply", "--recount", "--cached", NULL, NULL }; struct child_process child; @@ -303,6 +303,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix) die (_("Could not apply '%s'"), file); unlink(file); + free(file); return 0; }