mirror of
https://github.com/git/git.git
synced 2024-10-21 06:59:20 +02:00
mailinfo: plug strbuf leak during continuation line handling
Whether this loop is left via EOF/break or upon finding a non-continuation line, the storage used for the contination line handling is left behind. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e38ee06e99
commit
12d19e80b0
@ -409,6 +409,8 @@ static int is_rfc2822_header(const struct strbuf *line)
|
|||||||
|
|
||||||
static int read_one_header_line(struct strbuf *line, FILE *in)
|
static int read_one_header_line(struct strbuf *line, FILE *in)
|
||||||
{
|
{
|
||||||
|
struct strbuf continuation = STRBUF_INIT;
|
||||||
|
|
||||||
/* Get the first part of the line. */
|
/* Get the first part of the line. */
|
||||||
if (strbuf_getline(line, in, '\n'))
|
if (strbuf_getline(line, in, '\n'))
|
||||||
return 0;
|
return 0;
|
||||||
@ -430,7 +432,6 @@ static int read_one_header_line(struct strbuf *line, FILE *in)
|
|||||||
*/
|
*/
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int peek;
|
int peek;
|
||||||
struct strbuf continuation = STRBUF_INIT;
|
|
||||||
|
|
||||||
peek = fgetc(in); ungetc(peek, in);
|
peek = fgetc(in); ungetc(peek, in);
|
||||||
if (peek != ' ' && peek != '\t')
|
if (peek != ' ' && peek != '\t')
|
||||||
@ -441,6 +442,7 @@ static int read_one_header_line(struct strbuf *line, FILE *in)
|
|||||||
strbuf_rtrim(&continuation);
|
strbuf_rtrim(&continuation);
|
||||||
strbuf_addbuf(line, &continuation);
|
strbuf_addbuf(line, &continuation);
|
||||||
}
|
}
|
||||||
|
strbuf_release(&continuation);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user