]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: fix potential memory loss on error
authorVictor Julien <victor@inliniac.net>
Wed, 18 Dec 2013 11:17:56 +0000 (12:17 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 18 Dec 2013 11:17:56 +0000 (12:17 +0100)
Coverity 1139543.

If StreamTcpPseudoPacket would be called with len == 0, the packet
it acquired before checking the len value would be lost.

src/stream-tcp.c

index a17a4b6c12f9daa0787fc1bfea6bf0eb9787621a..d0ca665437138337ab3d8c5791b214146b456874 100644 (file)
@@ -5244,8 +5244,12 @@ Packet *StreamTcpPseudoSetup(Packet *parent, uint8_t *pkt, uint32_t len)
 {
     SCEnter();
 
+    if (len == 0) {
+        SCReturnPtr(NULL, "Packet");
+    }
+
     Packet *p = PacketGetFromQueueOrAlloc();
-    if (p == NULL || len == 0) {
+    if (p == NULL) {
         SCReturnPtr(NULL, "Packet");
     }