commit 6b91c19: [Minor] Plug memory leak

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Aug 29 13:21:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-08-29 14:19:57 +0100
URL: https://github.com/rspamd/rspamd/commit/6b91c19d4e6667aea0a65367b72662993f563a21 (HEAD -> master)

[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,


More information about the Commits mailing list