3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

hwsim: Fix leak of send_frame_info->user_data

In case the genl object is cleaned up prior to the callback being
called, the DBus message might get leaked.  Can only happen in bizarre
cases.
This commit is contained in:
Denis Kenzior 2018-01-30 23:00:46 -06:00
parent f22ec55efb
commit 17f55f3b4a

View File

@ -1208,6 +1208,8 @@ static void send_custom_frame_callback(struct l_genl_msg *msg, void *user_data)
struct l_dbus_message *message = info->user_data; struct l_dbus_message *message = info->user_data;
struct l_dbus_message *reply; struct l_dbus_message *reply;
info->user_data = NULL;
if (l_genl_msg_get_error(msg) < 0) { if (l_genl_msg_get_error(msg) < 0) {
/* Radio address or frequency didn't match */ /* Radio address or frequency didn't match */
l_debug("HWSIM_CMD_FRAME failed for destination %s: %d", l_debug("HWSIM_CMD_FRAME failed for destination %s: %d",
@ -1226,6 +1228,9 @@ static void send_custom_frame_destroy(void *user_data)
{ {
struct send_frame_info *info = user_data; struct send_frame_info *info = user_data;
if (info->user_data)
l_dbus_message_unref(info->user_data);
l_free(info->frame); l_free(info->frame);
l_free(info->radio); l_free(info->radio);
l_free(info); l_free(info);