]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: add sanity check in free function
authorEric Leblond <eric@regit.org>
Mon, 29 Jul 2013 12:58:07 +0000 (14:58 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 29 Jul 2013 14:08:37 +0000 (16:08 +0200)
src/source-af-packet.c

index b7a7725b945f3f52b5d9e7f10d3200d9283da9fe..23a8adc91e26fbdcc55d33664ba96efc7d56c901 100644 (file)
@@ -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);