From 6790b51921dbbf020e411bdbd8d6d6a3c5b32187 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 15 Dec 2017 08:23:00 +0000 Subject: [PATCH] [Minor] Set pointer to NULL after usage to avoid confusion --- src/libmime/mime_headers.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c index 95f8d9ba6..09c892719 100644 --- a/src/libmime/mime_headers.c +++ b/src/libmime/mime_headers.c @@ -202,8 +202,7 @@ rspamd_mime_headers_process (struct rspamd_task *task, GHashTable *target, case 1: /* We got something like header's name */ if (*p == ':') { - nh = - rspamd_mempool_alloc0 (task->task_pool, + nh = rspamd_mempool_alloc0 (task->task_pool, sizeof (struct rspamd_mime_header)); l = p - c; tmp = rspamd_mempool_alloc (task->task_pool, l + 1); @@ -357,8 +356,9 @@ rspamd_mime_headers_process (struct rspamd_task *task, GHashTable *target, /* We also validate utf8 and replace all non-valid utf8 chars */ rspamd_mime_charset_utf_enforce (nh->decoded, strlen (nh->decoded)); - rspamd_mime_header_add (task, target, order, nh, check_newlines); nh->order = norder ++; + rspamd_mime_header_add (task, target, order, nh, check_newlines); + nh = NULL; state = 0; break; case 5: @@ -368,6 +368,7 @@ rspamd_mime_headers_process (struct rspamd_task *task, GHashTable *target, nh->raw_len = p - nh->raw_value; nh->order = norder ++; rspamd_mime_header_add (task, target, order, nh, check_newlines); + nh = NULL; state = 0; break; case 99: -- 2.39.5