Bluetooth: samples: ipsp: Fix crash on TCP connection closure
Be sure to check for NULL pkt in receive callback, which means TCP EOF. The fix ported from echo_server sample. Jira: ZEP-2423 Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit is contained in:
parent
480cfac4f2
commit
7ef28df980
@ -270,10 +270,17 @@ static void tcp_received(struct net_context *context,
|
||||
void *user_data)
|
||||
{
|
||||
static char dbg[MAX_DBG_PRINT + 1];
|
||||
sa_family_t family = net_pkt_family(pkt);
|
||||
sa_family_t family;
|
||||
struct net_pkt *reply_pkt;
|
||||
int ret;
|
||||
|
||||
if (!pkt) {
|
||||
/* EOF condition */
|
||||
return;
|
||||
}
|
||||
|
||||
family = net_pkt_family(pkt);
|
||||
|
||||
snprintf(dbg, MAX_DBG_PRINT, "TCP IPv%c",
|
||||
family == AF_INET6 ? '6' : '4');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user