From cdd187a7f3f85ef03ad20feef33395a2af24b9a2 Mon Sep 17 00:00:00 2001 From: Andrew Webster Date: Fri, 22 Jan 2016 15:54:45 -0600 Subject: [PATCH] TCP: check for sndcb before using it --- net/tcp/tcp_send_buffered.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index d25a88567f..8dfa9fae0e 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -181,8 +181,11 @@ static inline void psock_lost_connection(FAR struct socket *psock, /* Do not allow any further callbacks */ - psock->s_sndcb->flags = 0; - psock->s_sndcb->event = NULL; + if (psock->s_sndcb != NULL) + { + psock->s_sndcb->flags = 0; + psock->s_sndcb->event = NULL; + } /* Free all queued write buffers */