LDB hidden memory leaks
Kamen Mazdrashki
kamenim at gmail.com
Sun Jul 4 15:38:51 MDT 2010
Hi guys,
As I wrote in the below mentioned thread, there are few functions in LDB
implementation
that are easy to leak memory with at present.
http://lists.samba.org/archive/samba-technical/2010-July/071967.html
While this behavior is not a problem for utilities that uses LDB like ldbadd
for example,
it is a problem for Samba itself as it is supposed to be working 24/7.
In case of Samba, memory allocated in ldb_context context and not freed
quickly is
leaked memory as it will go away with LDB connection, i.e. presumably never
:)
I've pushed two approaches to the problem:
1) Introduce new functions and declare old ones as obsolete
http://gitweb.samba.org/?p=kamenim/samba.git;a=shortlog;h=refs/heads/ldb-mem-fix-1
<http://gitweb.samba.org/?p=kamenim/samba.git;a=shortlog;h=refs/heads/ldb-mem-fix-1>2)
Allocate memory in NULL context internally, so we will be able to notice,
when those
functions are used in dangerous manner
http://gitweb.samba.org/?p=kamenim/samba.git;a=shortlog;h=refs/heads/ldb-mem-fix-2
<http://gitweb.samba.org/?p=kamenim/samba.git;a=shortlog;h=refs/heads/ldb-mem-fix-2>Both
branches affect only ldb_msg_canonicalize() function. It is basically the
same
for ldb_msg_diff() function.
IMO approach 1) is better one as it leaves no doubt of who the owner of the
memory is.
But this approach will change LDB ABI a little, which may be not acceptable
for everyone.
(If I recall correctly, Simo is a strong defender of LDB ABI)
Approach 2) tries to solve the problem without ABI change but I think it
will lead us
(or other LDB users) to the same problem soon or later.
So, what do you think?
--
CU,
Kamen Mazdrashki
Samba Team Developer http://samba.org
http://gitweb.samba.org/?p=kamenim/samba.git;a=summary
-------------------------------------
CISCO SYSTEMS BULGARIA EOOD
http://www.cisco.com/global/BG/
kamen.mazdrashki at postpath.com
More information about the samba-technical
mailing list