Skip to content

Commit

Permalink
pkg/lwip: add missing initialization for async_cb
Browse files Browse the repository at this point in the history
Without initializing async_cb to NULL it might be a value != NULL,
which leads to sock->async_cb.gen() being called mistakenly in _netconn_cb.

gnrc_sock already does it with "reg->async_cb.generic = NULL;"
  • Loading branch information
HendrikVE committed Oct 5, 2022
1 parent f02bc57 commit 0df72af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/lwip/contrib/sock/ip/lwip_sock_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int sock_ip_create(sock_ip_t *sock, const sock_ip_ep_t *local,
NETCONN_RAW)) == 0) {
sock->base.conn = tmp;
#if IS_ACTIVE(SOCK_HAS_ASYNC)
sock->base.async_cb.gen = NULL;
netconn_set_callback_arg(sock->base.conn, &sock->base);
#endif
}
Expand Down
1 change: 1 addition & 0 deletions pkg/lwip/contrib/sock/udp/lwip_sock_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ int sock_udp_create(sock_udp_t *sock, const sock_udp_ep_t *local,
NETCONN_UDP)) == 0) {
sock->base.conn = tmp;
#if IS_ACTIVE(SOCK_HAS_ASYNC)
sock->base.async_cb.gen = NULL;
netconn_set_callback_arg(sock->base.conn, &sock->base);
#endif
}
Expand Down

0 comments on commit 0df72af

Please sign in to comment.