Skip to content

Commit

Permalink
detect: fix possible leak found by coverity
Browse files Browse the repository at this point in the history
Conditions to create the leak are likely not reachable,
but this is still a bad pattern.
  • Loading branch information
catenacyber authored and victorjulien committed Jan 21, 2022
1 parent cc746b4 commit e806099
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/detect-engine-port.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e806099

Please sign in to comment.