linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix Memory leak
       [not found] <CGME20180518035758epcas1p180d3cc8c19a1fbdf2819a35d7062804d@epcas1p1.samsung.com>
@ 2018-05-18  3:57 ` Nagaraj D R
  2018-05-21  8:32   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Nagaraj D R @ 2018-05-18  3:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Syam Sidhardhan, Nagaraj D R

Memory associated with 'adv_data' will be leaked in case of
'generate_scan_rsp' failure
---
 src/advertising.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/advertising.c b/src/advertising.c
index 441d0a2..b087b48 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -752,6 +752,7 @@ static int refresh_adv(struct btd_adv_client *client, mgmt_request_func_t func)
 	scan_rsp = generate_scan_rsp(client, &flags, &scan_rsp_len);
 	if (!scan_rsp && scan_rsp_len) {
 		error("Scan data couldn't be generated.");
+		free(adv_data);
 		return -EINVAL;
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix Memory leak
  2018-05-18  3:57 ` [PATCH] Fix Memory leak Nagaraj D R
@ 2018-05-21  8:32   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2018-05-21  8:32 UTC (permalink / raw)
  To: Nagaraj D R; +Cc: linux-bluetooth@vger.kernel.org, Syam Sidhardhan

Hi,

On Fri, May 18, 2018 at 6:57 AM, Nagaraj D R <nagaraj.dr@samsung.com> wrote:
> Memory associated with 'adv_data' will be leaked in case of
> 'generate_scan_rsp' failure
> ---
>  src/advertising.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/advertising.c b/src/advertising.c
> index 441d0a2..b087b48 100644
> --- a/src/advertising.c
> +++ b/src/advertising.c
> @@ -752,6 +752,7 @@ static int refresh_adv(struct btd_adv_client *client, mgmt_request_func_t func)
>         scan_rsp = generate_scan_rsp(client, &flags, &scan_rsp_len);
>         if (!scan_rsp && scan_rsp_len) {
>                 error("Scan data couldn't be generated.");
> +               free(adv_data);
>                 return -EINVAL;
>         }
>
> --
> 1.9.1

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-21  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20180518035758epcas1p180d3cc8c19a1fbdf2819a35d7062804d@epcas1p1.samsung.com>
2018-05-18  3:57 ` [PATCH] Fix Memory leak Nagaraj D R
2018-05-21  8:32   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).