Skip to content

Commit 71165f0

Browse files
committed
Merge branch 'rs/mailinfo-lib' into maint
Small code clean-up. * rs/mailinfo-lib: mailinfo: recycle strbuf in check_header()
2 parents 9bef642 + ecf30b2 commit 71165f0

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

mailinfo.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,6 @@ static void handle_content_type(struct mailinfo *mi, struct strbuf *line)
179179
}
180180
}
181181

182-
static void handle_message_id(struct mailinfo *mi, const struct strbuf *line)
183-
{
184-
if (mi->add_message_id)
185-
mi->message_id = strdup(line->buf);
186-
}
187-
188182
static void handle_content_transfer_encoding(struct mailinfo *mi,
189183
const struct strbuf *line)
190184
{
@@ -495,7 +489,8 @@ static int check_header(struct mailinfo *mi,
495489
len = strlen("Message-Id: ");
496490
strbuf_add(&sb, line->buf + len, line->len - len);
497491
decode_header(mi, &sb);
498-
handle_message_id(mi, &sb);
492+
if (mi->add_message_id)
493+
mi->message_id = strbuf_detach(&sb, NULL);
499494
ret = 1;
500495
goto check_header_out;
501496
}

0 commit comments

Comments
 (0)