ldb_search interface considered harmful

Andrew Bartlett abartlet at samba.org
Tue Jan 31 05:02:49 GMT 2006


I've recently been working on the Samba4 code, and the output of
--leak-report-full in particular.

The contents of this (for an inactive connection) should be quite small,
but I initially found a large number of ldb_message structures being
kept around.  While some of this was easy to clean up, the problem
appears to be the interface:

int ldb_search(struct ldb_context *ldb,
               const struct ldb_dn *base,
               enum ldb_scope scope,
               const char *expression,
               const char * const *attrs, struct ldb_result **res);

Because the *res is returned on the ldb as a context, it often stays
there.  The gendb wrapper 'fixes' this, but we don't always use it.
Should we modify the interface to have an explicit mem_ctx argument, to
avoid the caller needing to manually talloc_steal?

Andrew Bartlett
-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Student Network Administrator, Hawker College  http://hawkerc.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20060131/48d88dd9/attachment.bin


More information about the samba-technical mailing list