Skip to content

Commit 126c19a

Browse files
authored
Merge pull request #5238 from dilyanpalauzov/memory_leak_parse_accept
httpd.c.c:parse_accept() memory leak
2 parents a29a567 + 15da05c commit 126c19a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: imap/httpd.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -2526,7 +2526,7 @@ dynarray_t *parse_accept(const char **hdr)
25262526
while ((token = tok_next(&tok))) {
25272527
struct param *params = NULL, *param;
25282528
char *type = NULL, *subtype = NULL;
2529-
struct accept accept = { .qual = 1.0 };
2529+
struct accept accept = { .qual = 1.0, .version = NULL, .charset = NULL };
25302530

25312531
message_parse_type(token, &type, &subtype, &params);
25322532

@@ -2540,9 +2540,11 @@ dynarray_t *parse_accept(const char **hdr)
25402540
accept.qual = strtof(param->value, NULL);
25412541
}
25422542
else if (!strcasecmp(param->attribute, "version")) {
2543+
free(accept.version);
25432544
accept.version = xstrdup(param->value);
25442545
}
25452546
else if (!strcasecmp(param->attribute, "charset")) {
2547+
free(accept.charset);
25462548
accept.charset = xstrdup(param->value);
25472549
}
25482550
}

0 commit comments

Comments
 (0)