summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-10-23 22:51:34 +1100
committerJunio C Hamano <gitster@pobox.com>2011-10-23 21:33:58 -0700
commit9cd7a92b97d0b4321c19e8952a3a9b1874e3abb5 (patch)
tree9247ee3ae609253629302b5a12792cda9acb7bc6 /pretty.c
parent7ed863a85a6ce2c4ac4476848310b8f917ab41f9 (diff)
downloadgit-9cd7a92b97d0b4321c19e8952a3a9b1874e3abb5.tar.gz
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>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/pretty.c b/pretty.c
index 8549934751..34d668cc30 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1013,7 +1013,6 @@ void format_commit_message(const struct commit *commit,
{
struct format_commit_context context;
static const char utf8[] = "UTF-8";
- const char *enc;
const char *output_enc = pretty_ctx->output_encoding;
memset(&context, 0, sizeof(context));
@@ -1022,10 +1021,10 @@ void format_commit_message(const struct commit *commit,
context.wrap_start = sb->len;
context.message = commit->buffer;
if (output_enc) {
- enc = get_header(commit, "encoding");
- enc = enc ? enc : utf8;
- if (strcmp(enc, output_enc))
+ char *enc = get_header(commit, "encoding");
+ if (strcmp(enc ? enc : utf8, output_enc))
context.message = logmsg_reencode(commit, output_enc);
+ free(enc);
}
strbuf_expand(sb, format, format_commit_item, &context);