Skip to content

Commit

Permalink
net: lwm2m: Initialize socket FD to an invalid value
Browse files Browse the repository at this point in the history
During registration, first thing LWM2M does is trying to close a socket
indicated by sock_fd stored in its context. In case it is not
initialized to some invalid value (-1 in this case), LWM2M may close an
ambigous socket.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
  • Loading branch information
rlubos authored and carlescufi committed Apr 21, 2020
1 parent 18c9c8c commit 8d984b3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions subsys/net/lib/lwm2m/lwm2m_rd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ void lwm2m_rd_client_start(struct lwm2m_ctx *client_ctx, const char *ep_name,
lwm2m_ctx_event_cb_t event_cb)
{
client.ctx = client_ctx;
client.ctx->sock_fd = -1;
client.event_cb = event_cb;

set_sm_state(ENGINE_INIT);
Expand Down

0 comments on commit 8d984b3

Please sign in to comment.