summaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2010-06-10 12:54:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-12 16:34:17 (GMT)
commit157aaea5fff7dbf2fc39829d827b35df647562a4 (patch)
tree71edb7de89dc8740a4e00ad1d758a4abb9b6a1e3 /builtin/checkout.c
parent86e8e7a566c5546e58f56566d0181a08d60f919f (diff)
downloadgit-157aaea5fff7dbf2fc39829d827b35df647562a4.zip
git-157aaea5fff7dbf2fc39829d827b35df647562a4.tar.gz
git-157aaea5fff7dbf2fc39829d827b35df647562a4.tar.bz2
log_ref_setup: don't return stack-allocated array
859c301 (refs: split log_ref_write logic into log_ref_setup, 2010-05-21) refactors the stack allocation of the log_file array into the new log_ref_setup() function, but passes it back to the caller. Since the original intent seems to have been to split the work between log_ref_setup and log_ref_write, make it the caller's responsibility to allocate the buffer. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 9d618c2..72e4fbc 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -496,12 +496,12 @@ static void update_refs_for_switch(struct checkout_opts *opts,
if (opts->new_orphan_branch) {
if (opts->new_branch_log && !log_all_ref_updates) {
int temp;
- char *log_file;
+ char log_file[PATH_MAX];
char *ref_name = mkpath("refs/heads/%s", opts->new_orphan_branch);
temp = log_all_ref_updates;
log_all_ref_updates = 1;
- if (log_ref_setup(ref_name, &log_file)) {
+ if (log_ref_setup(ref_name, log_file, sizeof(log_file))) {
fprintf(stderr, "Can not do reflog for '%s'\n",
opts->new_orphan_branch);
log_all_ref_updates = temp;