tevent memory leak?

Jeremy Allison jra at samba.org
Tue Feb 16 22:25:50 UTC 2016


On Tue, Feb 16, 2016 at 12:26:13PM +0100, Pavel Březina wrote:
> Hi,
> we are dealing with user-reported memory leak in sssd and I can see
> in talloc report that there are ~140k if struct sigaction:
> 
>     struct tevent_sig_state        contains 21149312 bytes in 139123
> blocks (ref 6) 0x7f0b97781990
>         struct sigaction               contains    152 bytes in   1
> blocks (ref 0) 0x7f0b9c1d9f10
>         struct sigaction               contains    152 bytes in   1
> blocks (ref 0) 0x7f0b9c195f80
>         struct sigaction               contains    152 bytes in   1
> blocks (ref 0) 0x7f0b9c195e80
>         struct sigaction               contains    152 bytes in   1
> blocks (ref 0) 0x7f0b9c195d80
>         ...
> 
> Looking into tevent code, it comes from tevent_common_add_signal():
> 
> sig_state->oldact[signum] = talloc(sig_state, struct sigaction);
> if (sig_state->oldact[signum] == NULL) {
>     talloc_free(se);
>     return NULL;
> }
> 
> But it is nowhere freed. I would expect it to be freed in signal
> destructor after restoring the original sigaction. Is it intentional
> or a bug?

I think this is a bug. Can you try the following (untested, but looks
right :-) patch ? If you can confirm I'll get a second review for
mater and we can log a bug to get a back-port.

Cheers,

	Jeremy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lib-tevent-Fix-memory-leak-reported-by-Pavel-B-ezina.patch
Type: text/x-diff
Size: 1750 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160216/c9b328d4/0001-lib-tevent-Fix-memory-leak-reported-by-Pavel-B-ezina.diff>


More information about the samba-technical mailing list