* [PATCH] hfp: Fix memory leak
@ 2014-10-28 13:28 Andrei Emeltchenko
2014-10-30 9:30 ` Szymon Janc
0 siblings, 1 reply; 2+ messages in thread
From: Andrei Emeltchenko @ 2014-10-28 13:28 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Free fmt allocated by asprintf().
---
src/shared/hfp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index 22e9622..9a66ed2 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -1321,8 +1321,10 @@ bool hfp_hf_send_command(struct hfp_hf *hfp, hfp_response_func_t resp_cb,
return false;
cmd = new0(struct cmd_response, 1);
- if (!cmd)
+ if (!cmd) {
+ free(fmt);
return false;
+ }
va_start(ap, format);
len = ringbuf_vprintf(hfp->write_buf, fmt, ap);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] hfp: Fix memory leak
2014-10-28 13:28 [PATCH] hfp: Fix memory leak Andrei Emeltchenko
@ 2014-10-30 9:30 ` Szymon Janc
0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-10-30 9:30 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
Hi Andrei,
On Tuesday 28 of October 2014 15:28:30 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Free fmt allocated by asprintf().
> ---
> src/shared/hfp.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/shared/hfp.c b/src/shared/hfp.c
> index 22e9622..9a66ed2 100644
> --- a/src/shared/hfp.c
> +++ b/src/shared/hfp.c
> @@ -1321,8 +1321,10 @@ bool hfp_hf_send_command(struct hfp_hf *hfp,
> hfp_response_func_t resp_cb, return false;
>
> cmd = new0(struct cmd_response, 1);
> - if (!cmd)
> + if (!cmd) {
> + free(fmt);
> return false;
> + }
>
> va_start(ap, format);
> len = ringbuf_vprintf(hfp->write_buf, fmt, ap);
Patch applied after fixing commit prefix, thanks.
--
BR
Szymon Janc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-30 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-28 13:28 [PATCH] hfp: Fix memory leak Andrei Emeltchenko
2014-10-30 9:30 ` Szymon Janc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox