]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: fix memory leak when failing to insert segment
authorPhilippe Antoine <pantoine@oisf.net>
Fri, 6 Jan 2023 16:49:22 +0000 (17:49 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 10 Jan 2023 10:12:00 +0000 (11:12 +0100)
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

src/stream-tcp-list.c

index e5024e7338ca6d1e8654f8dab98ddbf0dc37a640..9e3d27d12dc38dcd1f7aeb7cc46349207f7304ff 100644 (file)
@@ -703,6 +703,9 @@ int StreamTcpReassembleInsertSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_
             }
 #endif
         }
+    } else {
+        // EINVAL
+        StreamTcpSegmentReturntoPool(seg);
     }
 
     SCReturnInt(0);