From 0c36ea64c28d6cb64729cc1d942b84d35c189bdc Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 21 Dec 2017 12:00:28 +0100 Subject: [PATCH] detect/tos: fix memleak in error path --- src/detect-tos.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/detect-tos.c b/src/detect-tos.c index 1675374355..2d7c4e0a20 100644 --- a/src/detect-tos.c +++ b/src/detect-tos.c @@ -177,13 +177,15 @@ int DetectTosSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg) tosd = DetectTosParse(arg, s->init_data->negated); if (tosd == NULL) - goto error; + return -1; /* Okay so far so good, lets get this into a SigMatch * and put it in the Signature. */ sm = SigMatchAlloc(); - if (sm == NULL) - goto error; + if (sm == NULL) { + DetectTosFree(tosd); + return -1; + } sm->type = DETECT_TOS; sm->ctx = (SigMatchCtx *)tosd; @@ -192,9 +194,6 @@ int DetectTosSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg) s->flags |= SIG_FLAG_REQUIRE_PACKET; return 0; - -error: - return -1; } /** -- 2.47.2