Code

--pretty=format: fix broken %ct and %at interpolation
[git.git] / commit.c
index 5b9234e12e8d1ef46d0d53b15cea850dfbde14c2..a92958cfacbfa88eee4cc52fef0f85308ddfc372 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -706,7 +706,7 @@ static char *logmsg_reencode(const struct commit *commit,
        encoding = get_header(commit, "encoding");
        use_encoding = encoding ? encoding : utf8;
        if (!strcmp(use_encoding, output_encoding))
-               out = strdup(commit->buffer);
+               out = xstrdup(commit->buffer);
        else
                out = reencode_string(commit->buffer,
                                      output_encoding, use_encoding);
@@ -760,7 +760,7 @@ static void fill_person(struct interp *table, const char *msg, int len)
        if (msg + start == ep)
                return;
 
-       table[5].value = xstrndup(msg + start, ep - msg + start);
+       table[5].value = xstrndup(msg + start, ep - (msg + start));
 
        /* parse tz */
        for (start = ep - msg + 1; start < len && isspace(msg[start]); start++)