Skip to content

Commit

Permalink
httpd.c:parse_accept() memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
dilyanpalauzov committed Jan 27, 2025
1 parent a29a567 commit 15da05c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion imap/httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2526,7 +2526,7 @@ dynarray_t *parse_accept(const char **hdr)
while ((token = tok_next(&tok))) {
struct param *params = NULL, *param;
char *type = NULL, *subtype = NULL;
struct accept accept = { .qual = 1.0 };
struct accept accept = { .qual = 1.0, .version = NULL, .charset = NULL };

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

Expand All @@ -2540,9 +2540,11 @@ dynarray_t *parse_accept(const char **hdr)
accept.qual = strtof(param->value, NULL);
}
else if (!strcasecmp(param->attribute, "version")) {
free(accept.version);
accept.version = xstrdup(param->value);
}
else if (!strcasecmp(param->attribute, "charset")) {
free(accept.charset);
accept.charset = xstrdup(param->value);
}
}
Expand Down

0 comments on commit 15da05c

Please sign in to comment.