diff --git a/components/net/at/at_socket/at_socket.c b/components/net/at/at_socket/at_socket.c index d300415d86..c21d019717 100644 --- a/components/net/at/at_socket/at_socket.c +++ b/components/net/at/at_socket/at_socket.c @@ -404,11 +404,13 @@ int at_closesocket(int socket) if (at_dev_ops->at_closesocket(socket) != 0) { LOG_E("AT socket (%d) closesocket failed!", socket); + free_socket(sock); return -1; } } - return free_socket(sock); + free_socket(sock); + return 0; } int at_shutdown(int socket, int how) @@ -431,11 +433,13 @@ int at_shutdown(int socket, int how) if (at_dev_ops->at_closesocket(socket) != 0) { LOG_E("AT socket (%d) shutdown failed!", socket); + free_socket(sock); return -1; } } - return free_socket(sock); + free_socket(sock); + return 0; } int at_bind(int socket, const struct sockaddr *name, socklen_t namelen)