From cb2008fb27cbb47a3c8da0f3bafe3ddd882dd424 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 20 Nov 2018 12:22:47 +0100 Subject: [PATCH] detect: fix coverity memory leak warnings --- src/detect-isdataat.c | 2 +- src/detect-replace.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/detect-isdataat.c b/src/detect-isdataat.c index 654ac5ff36..36b99b595e 100644 --- a/src/detect-isdataat.c +++ b/src/detect-isdataat.c @@ -218,7 +218,7 @@ int DetectIsdataatSetup (DetectEngineCtx *de_ctx, Signature *s, const char *isda int sm_list; if (s->init_data->list != DETECT_SM_LIST_NOTSET) { if (DetectBufferGetActiveList(de_ctx, s) == -1) - return -1; + goto end; sm_list = s->init_data->list; if (idad->flags & ISDATAAT_RELATIVE) { diff --git a/src/detect-replace.c b/src/detect-replace.c index 3f9410bfad..3afc9395cd 100644 --- a/src/detect-replace.c +++ b/src/detect-replace.c @@ -83,10 +83,6 @@ int DetectReplaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char *replac return -1; } - int ret = DetectContentDataParse("replace", replacestr, &content, &len); - if (ret == -1) - return -1; - switch (run_mode) { case RUNMODE_NFQ: case RUNMODE_IPFW: @@ -99,6 +95,10 @@ int DetectReplaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char *replac return 0; } + int ret = DetectContentDataParse("replace", replacestr, &content, &len); + if (ret == -1) + return -1; + /* add to the latest "content" keyword from pmatch */ const SigMatch *pm = DetectGetLastSMByListId(s, DETECT_SM_LIST_PMATCH, DETECT_CONTENT, -1);