net: tcp: Cleanup context if connection is not established
If we are closing connection before the connection was established, then unref the context so that the cleanup is done properly. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
14ef05f93f
commit
29cae7e2fa
@ -1402,6 +1402,11 @@ int net_tcp_put(struct net_context *context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (context->tcp &&
|
||||
net_tcp_get_state(context->tcp) == NET_TCP_SYN_SENT) {
|
||||
net_context_unref(context);
|
||||
}
|
||||
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user