Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
bisect: copy filename string obtained from git_path()
author
Michael Haggerty
<mhagger@alum.mit.edu>
Thu, 26 Apr 2012 22:26:59 +0000
(
00:26
+0200)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 3 May 2012 20:15:35 +0000
(13:15 -0700)
Prevent the string from being overwritten by other callers of
git_path() and friends before we are done using it.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
989c0e5
)
diff --git
a/bisect.c
b/bisect.c
index 6e186e29cc4a6a74944798e8c4248219e9c5997f..48acf73391271c1d9061b178a53653357f07f391 100644
(file)
--- 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)
{
*/
static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
{
- c
onst char *filename = git_path("BISECT_ANCESTORS_OK"
);
+ c
har *filename = xstrdup(git_path("BISECT_ANCESTORS_OK")
);
struct stat st;
int fd;
struct stat st;
int fd;
@@
-842,11
+842,11
@@
static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
/* Check if file BISECT_ANCESTORS_OK exists. */
if (!stat(filename, &st) && S_ISREG(st.st_mode))
/* Check if file BISECT_ANCESTORS_OK exists. */
if (!stat(filename, &st) && S_ISREG(st.st_mode))
-
return
;
+
goto done
;
/* Bisecting with no good rev is ok. */
if (good_revs.nr == 0)
/* Bisecting with no good rev is ok. */
if (good_revs.nr == 0)
-
return
;
+
goto done
;
/* Check if all good revs are ancestor of the bad rev. */
if (check_ancestors(prefix))
/* Check if all good revs are ancestor of the bad rev. */
if (check_ancestors(prefix))
@@
-859,6
+859,8
@@
static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
filename, strerror(errno));
else
close(fd);
filename, strerror(errno));
else
close(fd);
+ done:
+ free(filename);
}
/*
}
/*