Merge branch 'maint'
[gitweb.git] / builtin / checkout.c
index 9d618c21d214b60e71ad6e2986234f95d738db07..1994be92c66257da18c31502bda605be170fd092 100644 (file)
@@ -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;
@@ -636,7 +636,8 @@ static int check_tracking_name(const char *refname, const unsigned char *sha1,
 
 static const char *unique_tracking_name(const char *name)
 {
-       struct tracking_name_data cb_data = { name, NULL, 1 };
+       struct tracking_name_data cb_data = { NULL, NULL, 1 };
+       cb_data.name = name;
        for_each_ref(check_tracking_name, &cb_data);
        if (cb_data.unique)
                return cb_data.remote;