leaks in ldb?

simo idra at samba.org
Sun Oct 15 18:23:08 GMT 2006

On Sun, 2006-10-15 at 21:36 +1000, tridge at samba.org wrote:
> Andrew and Simo,
> I've been chasing some memory leaks in ldb, and possibly in the
> ldb_map code as used by samba3sam.c
> The attached patch fixes up the leaks of struct ldb_handle, but leaks
> to a valgrind error in the ldb_map code when
> testprogs/ejs/samba3sam.js test is run. The error occurs on a unixName
> element created in ldb_msg_el_map_remote().
> I've also attached below the patch to db_wrap.c that I'm using to find
> these leaks. It reports a leak if a ldb context has more than 300
> blocks hanging off it when it is closed, which is a fairly reasonable
> heuristic. It shows we have _lots_ of leaks, and I bet most of them
> are basically because of the ldb_search() API and the fact that it
> doesn't take a destination context.

Yes ldb_search is built with the idea that you will either release the
result or steal them.

Feel free to commit any patch that fix memleaks by freeing/stealing the


Simo Sorce
Samba Team GPL Compliance Officer
email: idra at samba.org

More information about the samba-technical mailing list