detect: fix possible leak found by coverity

Conditions to create the leak are likely not reachable,
but this is still a bad pattern.
pull/6842/head
Philippe Antoine 5 years ago committed by Victor Julien
parent cc746b4594
commit e8060990d1

@ -213,8 +213,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