diff options
author | Tony Cho | 2015-09-07 12:09:31 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2015-09-13 03:24:45 +0200 |
commit | f638dd3918a4caa910ce62176d2d185203867876 (patch) | |
tree | d0a4e18997fb9420564bc2a8c0f8a5ef3590f6f0 /drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | |
parent | staging: wilc1000: remove unused preprocessor definition (diff) | |
download | kernel-qcow2-linux-f638dd3918a4caa910ce62176d2d185203867876.tar.gz kernel-qcow2-linux-f638dd3918a4caa910ce62176d2d185203867876.tar.xz kernel-qcow2-linux-f638dd3918a4caa910ce62176d2d185203867876.zip |
staging: wilc1000: fix potential memory leak
This patch adds kfree(mgmt_tx) when memory allocation of mgmt_tx->buff
fails in the second calls of kmalloc() to avoid the memory leak from mgmt_tx
first allocated before the second calls of kmalloc().
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Chris Park <chirs.park@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000/wilc_wfi_cfgoperations.c')
-rw-r--r-- | drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 663d0f818e4a..cf76a337a336 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2533,6 +2533,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy, mgmt_tx->buff = WILC_MALLOC(buf_len); if (mgmt_tx->buff == NULL) { PRINT_ER("Failed to allocate memory for mgmt_tx buff\n"); + kfree(mgmt_tx); return WILC_FAIL; } memcpy(mgmt_tx->buff, buf, len); |