Merge branch 'maint' of git://linux-nfs.org/~bfields/git into maint
[gitweb.git] / builtin-name-rev.c
index c022224361b62b527aca7822920ac8ea896ae585..ef1638590722017ad2cacca7ce30098fd0392bd5 100644 (file)
@@ -58,7 +58,10 @@ static void name_rev(struct commit *commit,
                        parents = parents->next, parent_number++) {
                if (parent_number > 1) {
                        int len = strlen(tip_name);
-                       char *new_name = xmalloc(len + 8);
+                       char *new_name = xmalloc(len +
+                               1 + decimal_length(generation) +  /* ~<n> */
+                               1 + 2 +                           /* ^NN */
+                               1);
 
                        if (len > 2 && !strcmp(tip_name + len - 2, "^0"))
                                len -= 2;