Code

Merge branch 'lt/diff-rename'
[git.git] / builtin-revert.c
index 499bbe7343a635f1c7fc024ed6a1436042dcb8ac..a655c8ee2ab25ef778b182fbd5ff298a732c1cfd 100644 (file)
@@ -168,9 +168,7 @@ static void set_author_ident_env(const char *message)
                        char *line, *pend, *email, *timestamp;
 
                        p += 7;
-                       line = xmalloc(eol + 1 - p);
-                       memcpy(line, p, eol - p);
-                       line[eol - p] = '\0';
+                       line = xmemdupz(p, eol - p);
                        email = strchr(line, '<');
                        if (!email)
                                die ("Could not extract author email from %s",