From: Eric Leblond Date: Mon, 29 Jul 2013 12:58:07 +0000 (+0200) Subject: af-packet: add sanity check in free function X-Git-Tag: suricata-2.0beta2~455 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4424f5a2313813579f96ec72e756e0b58071c64b;p=thirdparty%2Fsuricata.git af-packet: add sanity check in free function --- diff --git a/src/source-af-packet.c b/src/source-af-packet.c index b7a7725b94..23a8adc91e 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -884,6 +884,9 @@ static int AFPRefSocket(AFPPeer* peer) */ static int AFPDerefSocket(AFPPeer* peer) { + if (peer == NULL) + return 1; + if (SC_ATOMIC_SUB(peer->sock_usage, 1) == 0) { if (SC_ATOMIC_GET(peer->state) == AFP_STATE_DOWN) { SCLogInfo("Cleaning socket connected to '%s'", peer->iface);