From: Victor Julien Date: Fri, 19 Apr 2013 08:05:38 +0000 (+0200) Subject: Coverity 1005134: fix minor memory leak on flowvar rule setup errors. X-Git-Tag: suricata-2.0beta1~171 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=07b751b0df4c47678d4591932200248efcc91896;p=thirdparty%2Fsuricata.git Coverity 1005134: fix minor memory leak on flowvar rule setup errors. --- diff --git a/src/detect-flowvar.c b/src/detect-flowvar.c index 31b0475b28..7fc1492153 100644 --- a/src/detect-flowvar.c +++ b/src/detect-flowvar.c @@ -323,7 +323,7 @@ int DetectFlowvarPostMatchSetup(Signature *s, uint16_t idx) { fv->idx = idx; sm = SigMatchAlloc(); - if (sm == NULL) + if (unlikely(sm == NULL)) goto error; sm->type = DETECT_FLOWVAR_POSTMATCH; @@ -332,6 +332,8 @@ int DetectFlowvarPostMatchSetup(Signature *s, uint16_t idx) { SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_POSTMATCH); return 0; error: + if (fv != NULL) + DetectFlowvarDataFree(fv); return -1; }