Help: LIBLDAP.DLL makes GPF in ldap_result/ldap_msgdelete

Nils Andreas Thommesen (Nils.Thommesen@kvatro.no)
Fri, 9 Feb 1996 13:24:05 +0100

When I try to read the attributes of an entry, I can read them with no error.
But my problem arises at the *next* search, or rather waiting for the results
of the next search! Can anybody help me? Am I missing some call to LIBLDAP?

I have not been able to trace the execution into LIBLDAP.DLL, but I can see
the call stack contains three calls to ldap_result and the last call is to
ldap_msgdelete when the General Protection Fault occurs.

These are the calls I do to wait for a result:

do
{
res = ldap_result( m_current_ld, searchID, 1 , &timeout , &msg);
if (res == LDAP_RES_ANY)
break;
} while (res == 0);

I have been using both zero time to wait, and up to 1/2 seconds, it doesn't matter.
When I read the attributes, I do this: (simplified)

ldap_search( );
LDAPMessage *msg,*entry;
.... a call to the function above that waits for the result ...
entry = ldap_first_entry( m_current_ld, msg);
BerElement *ber;
char *attr;
char **values;
for (attr = ldap_first_attribute( m_current_ld, entry, &ber );
lstrlen(attr) != 0 ; attr =ldap_next_attribute( m_current_ld,
entry, ber) )
{
values = ldap_get_values( m_current_ld, entry, attr);
...save each of the values....
ldap_value_free(values);
if (attr)
free (attr);
}// end of for-loop over all attributes
if (msg)
{
ldap_msgfree(msg);
msg = NULL;
}
if (entry)
{
ldap_msgfree(entry);
entry = NULL;
}
ldap_msgdelete(m_current_ld, SearchID); // I have tried without this one, too.

It doesn't matter what I do *after* listing the attributes, it always gives me a GPF,
for a new "list attributes"-call, or when waiting for the results of a "browse" or a
"specific search".

Nils Andreas Thommesen -- Nils.Thommesen@kvatro.no
- - - - - - - - - - - - - - - - - - - - - -
Work: Kvatro-Notis, Pirsenteret, N-7005 Trondheim; +47 73 545 722
Home: E.B Schieldropsv. 9-24,7033 Trondheim,Norway; +47 73 8888 93
Fax : +47 73 545 750
WWW : http://www.kvatro.no/~nat http://www.kvatro.no/notis
- - - - - - - - - - - - - - - - - - - - - -
I'm left-handed, left-eyed, left-footed but not left behind!