[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: openldap and valgrind



Brian Hechinger wrote:
I'm having an interesting time running my code through valgrind.

Valgrind tell me this:

==31309== Conditional jump or move depends on uninitialised value(s)
==31309==    at 0x4033004: ldap_first_attribute (in /usr/lib/libldap-2.3.so.0.2.15)
==31309==    by 0x8053F45: ldap_to_xmlrpc (mod_ldap.c:504)

Line 504 of mod_lda.c is:

attr = ldap_first_attribute(mod_ldap_conn[thread_id], entry, attr_pointer);

Earlier, attr_pointer is declared:

BerElement **attr_pointer;

If I set it null at declaration:

BerElement **attr_pointer = NULL;

Valgrind stops complaining, but then the call to ldap_first_attribute()
hangs and never returns.

Is there a way I can make both of these happy?

Yes, call the function correctly.

BerElement *attr_pointer = NULL;
attr = ldap_first_attribute(mod_ldap_conn[thread_id], entry, &attr_pointer);

--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/