nl80211: Fix memory leaks on nla_put_failure error paths

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2011-12-17 12:27:11 +02:00
parent 5883168ae0
commit 9e088e743d

View File

@ -1777,6 +1777,7 @@ static int nl80211_get_noise_for_scan_results(
return send_and_recv_msgs(drv, msg, get_noise_for_scan_results,
scan_res);
nla_put_failure:
nlmsg_free(msg);
return -ENOBUFS;
}
@ -6921,6 +6922,7 @@ static int i802_get_seqnum(const char *iface, void *priv, const u8 *addr,
return send_and_recv_msgs(drv, msg, get_key_handler, seq);
nla_put_failure:
nlmsg_free(msg);
return -ENOBUFS;
}
@ -7011,6 +7013,7 @@ static int i802_flush(void *priv)
return send_and_recv_msgs(drv, msg, NULL, NULL);
nla_put_failure:
nlmsg_free(msg);
return -ENOBUFS;
}
@ -7085,6 +7088,7 @@ static int i802_read_sta_data(void *priv, struct hostap_sta_driver_data *data,
return send_and_recv_msgs(drv, msg, get_sta_handler, data);
nla_put_failure:
nlmsg_free(msg);
return -ENOBUFS;
}
@ -7141,7 +7145,9 @@ static int i802_set_tx_queue_params(void *priv, int queue, int aifs,
if (send_and_recv_msgs(drv, msg, NULL, NULL) == 0)
return 0;
msg = NULL;
nla_put_failure:
nlmsg_free(msg);
return -1;
}
@ -7167,6 +7173,7 @@ static int i802_set_sta_vlan(void *priv, const u8 *addr,
if_nametoindex(ifname));
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
msg = NULL;
if (ret < 0) {
wpa_printf(MSG_ERROR, "nl80211: NL80211_ATTR_STA_VLAN (addr="
MACSTR " ifname=%s vlan_id=%d) failed: %d (%s)",
@ -7174,6 +7181,7 @@ static int i802_set_sta_vlan(void *priv, const u8 *addr,
strerror(-ret));
}
nla_put_failure:
nlmsg_free(msg);
return ret;
}
@ -8323,6 +8331,7 @@ static int nl80211_pmkid(struct i802_bss *bss, int cmd, const u8 *bssid,
return send_and_recv_msgs(bss->drv, msg, NULL, NULL);
nla_put_failure:
nlmsg_free(msg);
return -ENOBUFS;
}