diff options
| author | Jinyao Guo <guo846@purdue.edu> | 2025-06-13 19:26:45 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-06-14 09:42:14 -0700 |
| commit | ff73f375bbff4b35ef97fb6890de9deaa90924f0 (patch) | |
| tree | 14cf0b968ad4f2f82504220ac25267ad45e475b6 | |
| parent | CI updates (diff) | |
| download | git-ff73f375bbff4b35ef97fb6890de9deaa90924f0.tar.gz git-ff73f375bbff4b35ef97fb6890de9deaa90924f0.zip | |
mailinfo.c: fix memory leak in function handle_content_type()
The function handle_content_type allocates memory for boundary
using xmalloc(sizeof(struct strbuf)). If (++mi->content_top >=
&mi->content[MAX_BOUNDARIES]) is true, the function returns
without freeing boundary.
Signed-off-by: Jinyao Guo <guo846@purdue.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | mailinfo.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mailinfo.c b/mailinfo.c index 7b001fa5db..0e9e0e315d 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -266,6 +266,8 @@ static void handle_content_type(struct mailinfo *mi, struct strbuf *line) error("Too many boundaries to handle"); mi->input_error = -1; mi->content_top = &mi->content[MAX_BOUNDARIES] - 1; + strbuf_release(boundary); + free(boundary); return; } *(mi->content_top) = boundary; |
