提交 e90068a9 编写于 作者: J Junio C Hamano

i18n: do not leak 'encoding' header even when we cheat the conversion.

We special case the case where encoding recorded in the commit
and the output encoding are the same and do not call iconv().
But we should drop 'encoding' header for this case as well for
consistency.
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 fbc90123
......@@ -679,11 +679,13 @@ static char *logmsg_reencode(const struct commit *commit)
else if (!*output_encoding)
return NULL;
encoding = get_header(commit, "encoding");
if (!encoding || !strcmp(encoding, output_encoding)) {
free(encoding);
if (!encoding)
return NULL;
}
out = reencode_string(commit->buffer, output_encoding, encoding);
if (!strcmp(encoding, output_encoding))
out = strdup(commit->buffer);
else
out = reencode_string(commit->buffer,
output_encoding, encoding);
if (out)
out = replace_encoding_header(out, output_encoding);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册