detect: fix possible leak found by coverity

Conditions to create the leak are likely not reachable,
but this is still a bad pattern.

(cherry picked from commit e8060990d1)
pull/8761/head
Philippe Antoine 4 years ago committed by Victor Julien
parent 5f1651282d
commit 79b89df331

@ -216,8 +216,12 @@ int DetectPortInsert(DetectEngineCtx *de_ctx, DetectPort **head,
goto error;
r = DetectPortInsert(de_ctx, head, new);
if (r == -1)
if (r == -1) {
if (c != NULL) {
DetectPortFree(de_ctx, c);
}
goto error;
}
if (c != NULL) {
SCLogDebug("inserting C (%p)", c);

Loading…
Cancel
Save