nl_socket_get_cb() increases cb_refcnf for the cb that is bound to a
socket and as such, nl_cb_put() needs to be used with the returned cb
after having cloned it to avoid leaking memory due to cb_refcnt never
getting back to 0.
Fixes: da0d51fee74b ("nl80211: Use socket cb instead of global->nl_cb in send_and_recv()")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
void *ack_data,
struct nl80211_err_info *err_info)
{
- struct nl_cb *cb;
+ struct nl_cb *cb, *s_nl_cb;
struct nl80211_ack_err_args err;
int opt;
err.err = -ENOMEM;
- cb = nl_cb_clone(nl_socket_get_cb(nl_handle));
+ s_nl_cb = nl_socket_get_cb(nl_handle);
+ cb = nl_cb_clone(s_nl_cb);
+ nl_cb_put(s_nl_cb);
if (!cb)
goto out;