travis-ci: print the "tip of branch is exactly at tag" message in color
[gitweb.git] / blame.c
diff --git a/blame.c b/blame.c
index 194b58e96066f9620005f64a57ca9ecc618c86f4..f575e9cbf4e3224049fe43b7f794d2dd8770eda7 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -229,7 +229,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
                if (strbuf_read(&buf, 0, 0) < 0)
                        die_errno("failed to read from stdin");
        }
-       convert_to_git(path, buf.buf, buf.len, &buf, 0);
+       convert_to_git(&the_index, path, buf.buf, buf.len, &buf, 0);
        origin->file.ptr = buf.buf;
        origin->file.size = buf.len;
        pretend_sha1_file(buf.buf, buf.len, OBJ_BLOB, origin->blob_oid.hash);
@@ -314,8 +314,7 @@ static void fill_origin_blob(struct diff_options *opt,
 static void drop_origin_blob(struct blame_origin *o)
 {
        if (o->file.ptr) {
-               free(o->file.ptr);
-               o->file.ptr = NULL;
+               FREE_AND_NULL(o->file.ptr);
        }
 }
 
@@ -1664,7 +1663,7 @@ static struct commit *find_single_final(struct rev_info *revs,
                name = revs->pending.objects[i].name;
        }
        if (name_p)
-               *name_p = name;
+               *name_p = xstrdup_or_null(name);
        return found;
 }
 
@@ -1736,7 +1735,7 @@ static struct commit *find_single_initial(struct rev_info *revs,
                die("No commit to dig up from?");
 
        if (name_p)
-               *name_p = name;
+               *name_p = xstrdup(name);
        return found;
 }
 
@@ -1844,6 +1843,8 @@ void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blam
 
        if (orig)
                *orig = o;
+
+       free((char *)final_commit_name);
 }