commit 0a2eb9a: [Project] Fix some final issues
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Jul 12 16:42:29 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-07-12 15:17:27 +0100
URL: https://github.com/rspamd/rspamd/commit/0a2eb9a433a41667b01863b61da4df42b3e48dec
[Project] Fix some final issues
---
src/libmime/message.c | 5 +++++
src/libmime/mime_headers.c | 12 ++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/libmime/message.c b/src/libmime/message.c
index a725d7e89..fb488b71b 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -1140,11 +1140,16 @@ rspamd_message_new (struct rspamd_task *task)
msg = rspamd_mempool_alloc0 (task->task_pool, sizeof (*msg));
msg->raw_headers = rspamd_message_headers_new ();
+
msg->emails = g_hash_table_new (rspamd_email_hash, rspamd_emails_cmp);
msg->urls = g_hash_table_new (rspamd_url_hash, rspamd_urls_cmp);
+
msg->parts = g_ptr_array_sized_new (4);
msg->text_parts = g_ptr_array_sized_new (2);
+ msg->from_mime = g_ptr_array_sized_new (1);
+ msg->rcpt_mime = g_ptr_array_sized_new (1);
+
REF_INIT_RETAIN (msg, rspamd_message_dtor);
return msg;
diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index bc8ace679..f9027b53d 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -1602,13 +1602,17 @@ rspamd_message_get_header_from_hash (khash_t(rspamd_mime_headers_htb) *htb,
{
khiter_t k;
- k = kh_get (rspamd_mime_headers_htb, htb, (gchar *)field);
+ if (htb) {
+ k = kh_get (rspamd_mime_headers_htb, htb, (gchar *) field);
- if (k == kh_end (htb)) {
- return NULL;
+ if (k == kh_end (htb)) {
+ return NULL;
+ }
+
+ return kh_value (htb, k);
}
- return kh_value (htb, k);
+ return NULL;
}
struct rspamd_mime_header *
More information about the Commits
mailing list