From 15da05cff79981ad5c671c8b8dec37a63131b9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Mon, 27 Jan 2025 11:18:34 +0100 Subject: [PATCH] httpd.c:parse_accept() memory leak --- imap/httpd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imap/httpd.c b/imap/httpd.c index 4681284b5a..87ac451a46 100644 --- a/imap/httpd.c +++ b/imap/httpd.c @@ -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, ¶ms); @@ -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); } }