From: Victor Julien Date: Wed, 18 Dec 2013 11:17:56 +0000 (+0100) Subject: stream: fix potential memory loss on error X-Git-Tag: suricata-2.0beta2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3714925d2bfc37387fd92f115529f0d6edc1ce44;p=thirdparty%2Fsuricata.git stream: fix potential memory loss on error Coverity 1139543. If StreamTcpPseudoPacket would be called with len == 0, the packet it acquired before checking the len value would be lost. --- diff --git a/src/stream-tcp.c b/src/stream-tcp.c index a17a4b6c12..d0ca665437 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -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"); }