Skip to content

Commit

Permalink
af-packet: add sanity check in free function
Browse files Browse the repository at this point in the history
  • Loading branch information
regit authored and victorjulien committed Jul 29, 2013
1 parent 8e68b35 commit 4424f5a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/source-af-packet.c
Expand Up @@ -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);
Expand Down

0 comments on commit 4424f5a

Please sign in to comment.