From: Philippe Antoine Date: Fri, 6 Jan 2023 16:49:22 +0000 (+0100) Subject: stream: fix memory leak when failing to insert segment X-Git-Tag: suricata-7.0.0-rc1~186 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fff4475d912d32d2fa0ab1d114d54ddf5273586e;p=thirdparty%2Fsuricata.git stream: fix memory leak when failing to insert segment As introduced by commit f848e34bcc266a2a4d8f5fc2661d2b430449b190 DoInsertSegment can now return `-EINVAL` and there was no generic handling of error values to return the tcp segment to its pool. Ticket: #5777 --- diff --git a/src/stream-tcp-list.c b/src/stream-tcp-list.c index e5024e7338..9e3d27d12d 100644 --- a/src/stream-tcp-list.c +++ b/src/stream-tcp-list.c @@ -703,6 +703,9 @@ int StreamTcpReassembleInsertSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ } #endif } + } else { + // EINVAL + StreamTcpSegmentReturntoPool(seg); } SCReturnInt(0);