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

index 28c39498b48049f5466b9089d52e90f5a86e0aba..f51113082fa6dfa024de7e98e68c53ada419bde8 100644 (file)
@@ -283,29 +283,22 @@ error:
  */
 int DetectTagSetup(DetectEngineCtx *de_ctx, Signature *s, const char *tagstr)
 {
-    DetectTagData *td = NULL;
-    SigMatch *sm = NULL;
-
-    td = DetectTagParse(tagstr);
-    if (td == NULL) goto error;
+    DetectTagData *td = DetectTagParse(tagstr);
+    if (td == NULL)
+        return -1;
 
-    sm = SigMatchAlloc();
-    if (sm == NULL)
-        goto error;
+    SigMatch *sm = SigMatchAlloc();
+    if (sm == NULL) {
+        DetectTagDataFree(td);
+        return -1;
+    }
 
     sm->type = DETECT_TAG;
     sm->ctx = (SigMatchCtx *)td;
 
     /* Append it to the list of tags */
     SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_TMATCH);
-
     return 0;
-
-error:
-    if (td != NULL) DetectTagDataFree(td);
-    if (sm != NULL) SCFree(sm);
-    return -1;
-
 }
 
 /** \internal