[prev in list] [next in list] [prev in thread] [next in thread]
List: samba-technical
Subject: Re: ldb_search interface considered harmful
From: Andrew Bartlett <abartlet () samba ! org>
Date: 2006-01-31 22:11:28
Message-ID: 1138745488.21640.171.camel () localhost ! localdomain
[Download RAW message or body]
On Tue, 2006-01-31 at 17:03 -0500, simo wrote:
> On Wed, 2006-02-01 at 07:41 +1100, Andrew Bartlett wrote:
> > The problem I have is that the default behaviour is to leak memory onto
> > the long-term context. Everything continues to work perfectly, but
> > memory leaks. Interfaces should be designed so that the easiest way to
> > code them is also the correct one. I assert (by handwaving) that
> > calling both ldb_search and talloc_steal (on success) isn't the easiest
> > way to use the interface, and therefore callers will get it wrong.
>
> Well the memory should be all dependent on the result, so forgetting to
> free the result is the real problem. It's like passing a memory context
> and forgetting to free it.
>
> Are you proposing to just add a mem_ctx parm to ldb_search and
> talloc_steal in ldb_search() or are you proposing to pass down this
> mem_ctx to the backend modules through ldb_request ?
The backend modules should put the ldb_result as a child of the
ldb_request structure (I don't think they all do that right now...), and
the ldb_result should then (by talloc_steal()) be put on the caller's
supplied mem_ctx.
Andrew Bartlett
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Student Network Administrator, Hawker College http://hawkerc.net
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic