]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix compiler warning and silence complaining unittests.
authorVictor Julien <victor@inliniac.net>
Thu, 23 Feb 2012 16:43:53 +0000 (17:43 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 23 Feb 2012 16:43:53 +0000 (17:43 +0100)
src/detect-engine-mpm.c

index 52f3521aa0c989ad50956ef491ed71b9a01432d2..b08c6dd325638396787b5ae6b74ebf7a95d6d342 100644 (file)
@@ -170,13 +170,19 @@ uint32_t PacketPatternSearchWithStreamCtx(DetectEngineThreadCtx *det_ctx,
 {
     SCEnter();
 
-    uint32_t ret;
+    uint32_t ret = 0;
+
+    if (p->flowflags & FLOW_PKT_TOSERVER) {
+        if (det_ctx->sgh->mpm_stream_ctx_ts == NULL)
+            SCReturnInt(0);
 
-    if (p->flowflags & FLOW_PKT_TOSERVER && det_ctx->sgh->mpm_stream_ctx_ts != NULL) {
         ret = mpm_table[det_ctx->sgh->mpm_stream_ctx_ts->mpm_type].
             Search(det_ctx->sgh->mpm_stream_ctx_ts, &det_ctx->mtc, &det_ctx->pmq,
                    p->payload, p->payload_len);
-    } else if (p->flowflags & FLOW_PKT_TOCLIENT && det_ctx->sgh->mpm_stream_ctx_tc != NULL) {
+    } else {
+        if (det_ctx->sgh->mpm_stream_ctx_tc == NULL)
+            SCReturnInt(0);
+
         ret = mpm_table[det_ctx->sgh->mpm_stream_ctx_tc->mpm_type].
             Search(det_ctx->sgh->mpm_stream_ctx_tc, &det_ctx->mtc, &det_ctx->pmq,
                    p->payload, p->payload_len);