Skip to content

Commit

Permalink
net: sntp: close socket when connect failed
Browse files Browse the repository at this point in the history
The socket must be closed when the connection failed

Signed-off-by: Julien D'Ascenzio <[email protected]>
  • Loading branch information
jdascenzio authored and jukkar committed Apr 8, 2020
1 parent 3b49d01 commit c413cca
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions subsys/net/lib/sntp/sntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ int sntp_init(struct sntp_ctx *ctx, struct sockaddr *addr, socklen_t addr_len)

ret = connect(ctx->sock.fd, addr, addr_len);
if (ret < 0) {
(void)close(ctx->sock.fd);
NET_ERR("Cannot connect to UDP remote : %d", errno);
return -errno;
}
Expand Down

0 comments on commit c413cca

Please sign in to comment.