pretty.c: free get_header() return value

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Oct 23, 2011 at 22:51 UTC 9cd7a92b97d0b4321c19e8952a3a9b1874e3abb5
1 file changed +3 -4
pretty.c
+3 -4
@@ -1013,7 +1013,6 @@ void format_commit_message(const struct commit *commit,
1013 {
1014 struct format_commit_context context;
1015 static const char utf8[] = "UTF-8";
1016 - const char *enc;
1016 const char *output_enc = pretty_ctx->output_encoding;
1017
1018 memset(&context, 0, sizeof(context));
@@ -1022,10 +1021,10 @@ void format_commit_message(const struct commit *commit,
1021 context.wrap_start = sb->len;
1022 context.message = commit->buffer;
1023 if (output_enc) {
1025 - enc = get_header(commit, "encoding");
1026 - enc = enc ? enc : utf8;
1027 - if (strcmp(enc, output_enc))
1024 + char *enc = get_header(commit, "encoding");
1025 + if (strcmp(enc ? enc : utf8, output_enc))
1026 context.message = logmsg_reencode(commit, output_enc);
1027 + free(enc);
1028 }
1029
1030 strbuf_expand(sb, format, format_commit_item, &context);