From 056008690ae838e57b5379b9175e389219940a62 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 12 Nov 2017 23:15:33 +0000 Subject: [PATCH] [Fix] Plug another possible memory leak MFH: rspamd-1.6 --- src/libmime/content_type.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/libmime/content_type.c b/src/libmime/content_type.c index 240e2fab5..7ba9df690 100644 --- a/src/libmime/content_type.c +++ b/src/libmime/content_type.c @@ -461,6 +461,8 @@ rspamd_content_disposition_add_param (rspamd_mempool_t *pool, else { cd->attrs = g_hash_table_new (rspamd_ftok_icase_hash, rspamd_ftok_icase_equal); + rspamd_mempool_add_destructor (pool, + (rspamd_mempool_destruct_t)g_hash_table_unref, cd->attrs); } nparam = rspamd_mempool_alloc (pool, sizeof (*nparam)); @@ -498,11 +500,6 @@ rspamd_content_disposition_parse (const gchar *in, if (rspamd_content_disposition_parser (in, len, &val, pool)) { res = rspamd_mempool_alloc (pool, sizeof (val)); memcpy (res, &val, sizeof (val)); - - if (res->attrs) { - rspamd_mempool_add_destructor (pool, - (rspamd_mempool_destruct_t)g_hash_table_unref, res->attrs); - } } else { msg_warn_pool ("cannot parse content disposition: %*s", -- 2.39.5