On Sun, 2009-12-13 at 10:59 +0100, Ralf Becker wrote:
+attr_names_r[i] = p_strdup(auth_request->pool, str_c(str));
auth_request->pool gets freed when this auth request finishes.
+hash_insert(conn->user_attr_map,attr_names_r[i],
- hash_lookup(conn->user_attr_map,attr_names[i]));
Here you add it to conn->*_attr_map and it stays permanently there. So it looks like it's leaking memory for each request, and also if there are hash collisions it'll probably crash because there are entries that point to freed memory.
So you probably should be doing something like first checking if there already exists such an entry in hash, and if not then do i_strdup() for the name before adding it to hash.
I was thinking about adding something like this to v2.0 code, but the hash table updating is pretty ugly.. I think I'll wait adding this until I'll do a larger rewrite of LDAP configuration.