net/inet: Fix a memory leak when closing a TCP socket.

This commit is contained in:
Gregory Nutt 2017-11-03 06:44:40 -06:00
parent f3286d83e7
commit 63a8d79553
1 changed files with 5 additions and 1 deletions

View File

@ -348,7 +348,11 @@ static inline int tcp_close_disconnect(FAR struct socket *psock)
* release it now.
*/
psock->s_sndcb = NULL;
if (psock->s_sndcb != NULL)
{
tcp_callback_free(conn, psock->s_sndcb);
psock->s_sndcb = NULL;
}
#endif
/* Check for the case where the host beat us and disconnected first */