]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/mark: minor code cleanups
authorVictor Julien <victor@inliniac.net>
Sat, 16 Mar 2019 07:05:17 +0000 (08:05 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 21 Mar 2019 18:19:04 +0000 (19:19 +0100)
src/detect-mark.c

index 1dc41f9b2fdbb06dc12fc85ee67e07e82152d03d..bdb8fe0e215f54d5afee2568bb87a715b836a783 100644 (file)
@@ -184,29 +184,24 @@ static void * DetectMarkParse (const char *rawstr)
  */
 static int DetectMarkSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawstr)
 {
-#ifdef NFQ
-    DetectMarkData *data = NULL;
-    SigMatch *sm = NULL;
-
-    data = DetectMarkParse(rawstr);
-
+#ifndef NFQ
+    return 0;
+#else
+    DetectMarkData *data = DetectMarkParse(rawstr);
     if (data == NULL) {
         return -1;
-    } else {
-        sm = SigMatchAlloc();
-        if (sm == NULL) {
-            DetectMarkDataFree(data);
-            return -1;
-        }
+    }
+    SigMatch *sm = SigMatchAlloc();
+    if (sm == NULL) {
+        DetectMarkDataFree(data);
+        return -1;
+    }
 
-        sm->type = DETECT_MARK;
-        sm->ctx = (SigMatchCtx *)data;
+    sm->type = DETECT_MARK;
+    sm->ctx = (SigMatchCtx *)data;
 
-        /* Append it to the list of tags */
-        SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_TMATCH);
-        return 0;
-    }
-#else
+    /* Append it to the list of tags */
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_TMATCH);
     return 0;
 #endif
 }