From: Victor Julien Date: Tue, 23 Oct 2018 12:10:18 +0000 (+0200) Subject: ipproto: fix memleak in error case X-Git-Tag: suricata-4.0.6~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f000b70b9ac817bbc94e3fe69cb8e5ddd64cd1bd;p=thirdparty%2Fsuricata.git ipproto: fix memleak in error case --- diff --git a/src/detect-ipproto.c b/src/detect-ipproto.c index 0eba42e6ca..f641f4520d 100644 --- a/src/detect-ipproto.c +++ b/src/detect-ipproto.c @@ -184,12 +184,11 @@ static int DetectIPProtoTypePresentForOP(Signature *s, uint8_t op) static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char *optstr) { SigMatch *sm = NULL; - DetectIPProtoData *data = NULL; int i; - data = DetectIPProtoParse(optstr); + DetectIPProtoData *data = DetectIPProtoParse(optstr); if (data == NULL) { - goto error; + return -1; } /* Reset our "any" (or "ip") state: for ipv4, ipv6 and ip cases, the bitfield @@ -422,6 +421,7 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, const char error: + DetectIPProtoFree(data); return -1; }