summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordmitry pervushin <dpervushin@nvidia.com>2020-03-12 13:35:27 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2020-03-23 11:08:49 -0400
commit27ffe7184031157ed13df306b83660679d8eb662 (patch)
treea90ce7ebc1bddfda61280f8ab5924291bde99842
parentb22b022bc12ca4c238e632eb0e896419da72cfb8 (diff)
wifi: fix memory leak
each kmalloc should have its own kfree This fixes coverity issue 33605 Bug 2028892 Change-Id: I5903ec44cca0ad274e434df5517972b357991c0b Signed-off-by: dmitry pervushin <dpervushin@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2311738 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Phoenix Jung <pjung@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/net/wireless/bcmdhd_pcie/wldev_common.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/wireless/bcmdhd_pcie/wldev_common.c b/drivers/net/wireless/bcmdhd_pcie/wldev_common.c
index 61280157e..0eec088ea 100644
--- a/drivers/net/wireless/bcmdhd_pcie/wldev_common.c
+++ b/drivers/net/wireless/bcmdhd_pcie/wldev_common.c
@@ -4,6 +4,7 @@
4 * Portions of this code are copyright (c) 2017 Cypress Semiconductor Corporation 4 * Portions of this code are copyright (c) 2017 Cypress Semiconductor Corporation
5 * 5 *
6 * Copyright (C) 1999-2017, Broadcom Corporation 6 * Copyright (C) 1999-2017, Broadcom Corporation
7 * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
7 * 8 *
8 * Unless you and Broadcom execute a separate written software license 9 * Unless you and Broadcom execute a separate written software license
9 * agreement governing use of this software, this software is licensed to you 10 * agreement governing use of this software, this software is licensed to you
@@ -374,7 +375,8 @@ int wldev_get_mode(
374 error = wldev_ioctl(dev, WLC_GET_BSS_INFO, (void*)buf, WL_EXTRA_BUF_MAX, false); 375 error = wldev_ioctl(dev, WLC_GET_BSS_INFO, (void*)buf, WL_EXTRA_BUF_MAX, false);
375 if (error) { 376 if (error) {
376 WLDEV_ERROR(("%s:failed:%d\n", __FUNCTION__, error)); 377 WLDEV_ERROR(("%s:failed:%d\n", __FUNCTION__, error));
377 return -1; 378 error = -1;
379 goto out;
378 } 380 }
379 bss = (struct wl_bss_info *)(buf + 4); 381 bss = (struct wl_bss_info *)(buf + 4);
380 chanspec = wl_chspec_driver_to_host(bss->chanspec); 382 chanspec = wl_chspec_driver_to_host(bss->chanspec);
@@ -401,10 +403,13 @@ int wldev_get_mode(
401 strcpy(cap, "a"); 403 strcpy(cap, "a");
402 } else { 404 } else {
403 WLDEV_ERROR(("%s:Mode get failed\n", __FUNCTION__)); 405 WLDEV_ERROR(("%s:Mode get failed\n", __FUNCTION__));
404 return -1; 406 error = -1;
407 goto out;
405 } 408 }
406 409
407 } 410 }
411out:
412 kfree(buf);
408 return error; 413 return error;
409} 414}
410int wldev_set_country( 415int wldev_set_country(