* [PATCH] shared/mainloop: Fix timeout data memleak
@ 2016-12-07 13:44 Loic Poulain
2016-12-07 15:11 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 4+ messages in thread
From: Loic Poulain @ 2016-12-07 13:44 UTC (permalink / raw
To: luiz.dentz; +Cc: linux-bluetooth, Loic Poulain
Valgrind reports "timeout_data" as definitely lost.
Fix this issue in timeout_destroy function.
---
src/shared/mainloop.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/shared/mainloop.c b/src/shared/mainloop.c
index eacb6a4..09c46a7 100644
--- a/src/shared/mainloop.c
+++ b/src/shared/mainloop.c
@@ -283,6 +283,8 @@ static void timeout_destroy(void *user_data)
if (data->destroy)
data->destroy(data->user_data);
+
+ free(data);
}
static void timeout_callback(int fd, uint32_t events, void *user_data)
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] shared/mainloop: Fix timeout data memleak
2016-12-07 13:44 [PATCH] shared/mainloop: Fix timeout data memleak Loic Poulain
@ 2016-12-07 15:11 ` Luiz Augusto von Dentz
2016-12-07 15:39 ` loic.poulain
0 siblings, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-12-07 15:11 UTC (permalink / raw
To: Loic Poulain; +Cc: linux-bluetooth@vger.kernel.org
Hi Loic,
On Wed, Dec 7, 2016 at 3:44 PM, Loic Poulain <loic.poulain@gmail.com> wrote:
> Valgrind reports "timeout_data" as definitely lost.
> Fix this issue in timeout_destroy function.
> ---
> src/shared/mainloop.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/shared/mainloop.c b/src/shared/mainloop.c
> index eacb6a4..09c46a7 100644
> --- a/src/shared/mainloop.c
> +++ b/src/shared/mainloop.c
> @@ -283,6 +283,8 @@ static void timeout_destroy(void *user_data)
>
> if (data->destroy)
> data->destroy(data->user_data);
> +
> + free(data);
> }
Seems valid but can you add the backtrace, I wonder how we didn't spot
this before so perhaps the backtrace would explain it.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] shared/mainloop: Fix timeout data memleak
2016-12-07 15:11 ` Luiz Augusto von Dentz
@ 2016-12-07 15:39 ` loic.poulain
2016-12-08 10:56 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 4+ messages in thread
From: loic.poulain @ 2016-12-07 15:39 UTC (permalink / raw
To: Luiz Augusto von Dentz, Loic Poulain; +Cc: linux-bluetooth@vger.kernel.org
Hi Luiz,
> Seems valid but can you add the backtrace, I wonder how we didn't spot
> this before so perhaps the backtrace would explain it.
>
Actually, I included this useful shared code in a different project/poc,
don't have backtrace in a bluez context.
This could explain why you've never met this issue (timeout/timerfd
seems only used in emulator).
Regards,
Loic
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] shared/mainloop: Fix timeout data memleak
2016-12-07 15:39 ` loic.poulain
@ 2016-12-08 10:56 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-12-08 10:56 UTC (permalink / raw
To: Loic Poulain; +Cc: linux-bluetooth@vger.kernel.org
Hi Loic,
On Wed, Dec 7, 2016 at 5:39 PM, <loic.poulain@gmail.com> wrote:
> Hi Luiz,
>
>> Seems valid but can you add the backtrace, I wonder how we didn't spot
>> this before so perhaps the backtrace would explain it.
>>
>
> Actually, I included this useful shared code in a different project/poc,
> don't have backtrace in a bluez context.
> This could explain why you've never met this issue (timeout/timerfd seems
> only used in emulator).
Fair enough, applied, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-08 10:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-07 13:44 [PATCH] shared/mainloop: Fix timeout data memleak Loic Poulain
2016-12-07 15:11 ` Luiz Augusto von Dentz
2016-12-07 15:39 ` loic.poulain
2016-12-08 10:56 ` Luiz Augusto von Dentz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.