From 68ddcdccde5d4d6435d405d6ebaa64041fe54583 Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Mon, 23 May 2016 11:06:39 +1000 Subject: [PATCH] app-layer-smtp: init mpm thread ctx after prepare This allows the Hyperscan MPM to correctly allocate scratch. --- src/app-layer-smtp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index 8bdb1f54ff..98870a8e24 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -1437,13 +1437,6 @@ static void SMTPSetMpmState(void) memset(smtp_mpm_ctx, 0, sizeof(MpmCtx)); MpmInitCtx(smtp_mpm_ctx, SMTP_MPM); - smtp_mpm_thread_ctx = SCMalloc(sizeof(MpmThreadCtx)); - if (unlikely(smtp_mpm_thread_ctx == NULL)) { - exit(EXIT_FAILURE); - } - memset(smtp_mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitThreadCtx(smtp_mpm_thread_ctx, SMTP_MPM); - uint32_t i = 0; for (i = 0; i < sizeof(smtp_reply_map)/sizeof(SCEnumCharMap) - 1; i++) { SCEnumCharMap *map = &smtp_reply_map[i]; @@ -1454,6 +1447,13 @@ static void SMTPSetMpmState(void) } mpm_table[SMTP_MPM].Prepare(smtp_mpm_ctx); + + smtp_mpm_thread_ctx = SCMalloc(sizeof(MpmThreadCtx)); + if (unlikely(smtp_mpm_thread_ctx == NULL)) { + exit(EXIT_FAILURE); + } + memset(smtp_mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); + MpmInitThreadCtx(smtp_mpm_thread_ctx, SMTP_MPM); } int SMTPStateGetEventInfo(const char *event_name, -- 2.47.3