forked from Minki/linux
staging: wilc1000: fix memory leak in wilc_add_rx_gtk
In case *mode* happens to be different than WILC_AP_MODE and WILC_STATION_MODE, gtk_key is not released, hence leanding to a memory leak. So, in this case it is safer to release gtk_key just before returning to callers. Addresses-Coverity-ID: 1476020 ("Resource leak") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b62ce02e15
commit
fe2570fbf3
@ -1744,7 +1744,6 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
|
||||
result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
|
||||
ARRAY_SIZE(wid_list),
|
||||
wilc_get_vif_idx(vif));
|
||||
kfree(gtk_key);
|
||||
} else if (mode == WILC_STATION_MODE) {
|
||||
struct wid wid;
|
||||
|
||||
@ -1754,9 +1753,9 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
|
||||
wid.val = (u8 *)gtk_key;
|
||||
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
|
||||
wilc_get_vif_idx(vif));
|
||||
kfree(gtk_key);
|
||||
}
|
||||
|
||||
kfree(gtk_key);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user