On Fri, Aug 31, 2001 at 10:34:15AM -0400, Juan Marchionatto wrote:
% Alan, Peter,
% am I missing something (again) or the ldap_connect routine should
% ldap_msgfree(res) before returning?
%
% This may be specially important when returning OK, because there is not even
% an ldap_unbind (which might eventually free the memory) in that case.
You're right; the result passed to ldap_result() needs to be freed by the
caller. The diff below frees them properly.
I also read the source to rlm_ldap (albeit not as thoroughly as I'd like)
and couldn't find any more situations like this. Somehow I doubt that this
is the only source of the LDAP leaks I've seen reported. ldap_connect() only
gets called when the module is first initialized and when the LDAP server
goes away, so unless your LDAP server is bouncing like a rubber ball, I
don't see how this could account for the leaks I recall hearing about.
john
Index: rlm_ldap.c
===================================================================
RCS file: /source/radiusd/src/modules/rlm_ldap/rlm_ldap.c,v
retrieving revision 1.50
diff -u -r1.50 rlm_ldap.c
--- rlm_ldap.c 2001/08/28 20:01:48 1.50
+++ rlm_ldap.c 2001/09/01 15:28:41
@@ -640,10 +641,12 @@
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ldap_errno);
radlog(L_ERR, "rlm_ldap: %s bind failed: %s", dn, (rc == 0) ?
"timeout" : ldap_err2string(ldap_errno));
*result = RLM_MODULE_FAIL;
+ ldap_msgfree(res);
ldap_unbind_s(ld);
return (NULL);
}
ldap_errno = ldap_result2error(ld, res, 1);
+ ldap_msgfree(res);
switch (ldap_errno) {
case LDAP_SUCCESS:
*result = RLM_MODULE_OK;
--
John Morrissey _o /\ ---- __o
[EMAIL PROTECTED] _-< \_ / \ ---- < \,
www.horde.net/ __(_)/_(_)________/ \_______(_) /_(_)__
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html