LDB hidden memory leaks
kamenim at samba.org
Mon Jul 12 19:07:27 MDT 2010
On Tue, Jul 13, 2010 at 03:17, Andrew Bartlett <abartlet at samba.org> wrote:
> On Tue, 2010-07-13 at 02:43 +0300, Kamen Mazdrashki wrote:
> > On Tue, Jul 13, 2010 at 01:10, simo <idra at samba.org> wrote:
> > Even if it were I would not be thrilled by such a change.
> > Why you pass an argument is clear as soon as you look at the
> > function
> > definition of the function you are calling.
> > This is exactly what I want to avoid, right :)
> > Forcing TALLOC_CTX* explicit cast may be implemented
> > with compile time warnings - we just need to re-typedef TALLOC_CTX.
> > Look what a patch I got this way:
> I don't see how that patch would change anything in terms of the
> warnings, but in terms of self-documenting code, this is a change that
> should be applied. The void * here comes from an earlier time in ldb
> when it did not always have to use talloc(). This particular oddity was
> done away with a long time ago.
> Anyway, your patch is good, the TALLOC_CTX * is still a void *, but at
> least now the programmer has a better clue as to what it is used for.
> However, we can't change TALLOC_CTX * from void * without breaking the
> taloc API.
The patch just illustrated what we can do in just few minutes
when we have better types/prototypes, not typedef itself.
Self-documented code will pay off in long term.
And that's what I propose with explicit TALLOC_CTX casts.
Anyway, I am leaving this discussion at this point, as my vacation
starts in the end of the week and I have plenty of things to be done
by that time :)
Most important one is 'ldb mem leak' patches to get into master.
Anatoliy did some tests today and it seems we are not leaking
ldb_msg objects anymore.
More information about the samba-technical