From 6b91c19d4e6667aea0a65367b72662993f563a21 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 29 Aug 2020 14:19:57 +0100 Subject: [PATCH] [Minor] Plug memory leak --- src/libmime/mime_headers.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c index 6e26c1890..58e1b7ca0 100644 --- a/src/libmime/mime_headers.c +++ b/src/libmime/mime_headers.c @@ -1625,11 +1625,13 @@ rspamd_smtp_received_parse (struct rspamd_task *task, case RSPAMD_RECEIVED_PART_FOR: rh->for_addr = rspamd_email_address_from_smtp (cur->data, cur->dlen); - if (rh->for_addr && rh->for_addr->addr_len > 0) { - t1.begin = rh->for_addr->addr; - t1.len = rh->for_addr->addr_len; - rh->for_mbox = rspamd_mempool_ftokdup (task->task_pool, - &t1); + if (rh->for_addr) { + if (rh->for_addr->addr_len > 0) { + t1.begin = rh->for_addr->addr; + t1.len = rh->for_addr->addr_len; + rh->for_mbox = rspamd_mempool_ftokdup (task->task_pool, + &t1); + } rspamd_mempool_add_destructor (task->task_pool, (rspamd_mempool_destruct_t)rspamd_email_address_free, -- 2.39.5