From 07b751b0df4c47678d4591932200248efcc91896 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 19 Apr 2013 10:05:38 +0200 Subject: [PATCH] Coverity 1005134: fix minor memory leak on flowvar rule setup errors. --- src/detect-flowvar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; }