]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/tenants: fix crash when adding mapping
authorVictor Julien <victor@inliniac.net>
Mon, 25 Jun 2018 09:15:16 +0000 (11:15 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 26 Jun 2018 10:52:06 +0000 (12:52 +0200)
When no tenants and mappings are defined in 'live' mode, adding a
mapping resulted in a crash.

src/detect-engine.c

index 8e61aa999150866f7990a7ec17f50fca277e48e8..22cbb236fc57f89644e14c9f10d8ddc5905e6670 100644 (file)
@@ -2363,10 +2363,12 @@ static DetectEngineThreadCtx *DetectEngineThreadCtxInitForReload(
     }
 
     /* most of the init happens here */
-    if (ThreadCtxDoInit(det_ctx->de_ctx, det_ctx) != TM_ECODE_OK) {
-        DetectEngineDeReference(&det_ctx->de_ctx);
-        SCFree(det_ctx);
-        return NULL;
+    if (det_ctx->de_ctx->minimal == 0) {
+        if (ThreadCtxDoInit(det_ctx->de_ctx, det_ctx) != TM_ECODE_OK) {
+            DetectEngineDeReference(&det_ctx->de_ctx);
+            SCFree(det_ctx);
+            return NULL;
+        }
     }
 
     /** alert counter setup */