From: Victor Julien Date: Sat, 16 Mar 2019 07:11:42 +0000 (+0100) Subject: detect/tag: minor code cleanup X-Git-Tag: suricata-5.0.0-beta1~125 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=119db92c999e4efd4ec53da49933a6ba9f14127e;p=thirdparty%2Fsuricata.git detect/tag: minor code cleanup --- diff --git a/src/detect-tag.c b/src/detect-tag.c index 28c39498b4..f51113082f 100644 --- a/src/detect-tag.c +++ b/src/detect-tag.c @@ -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