- }
-
- if ( lr->lr_res_matched != NULL ) {
- LDAP_FREE( lr->lr_res_matched );
- lr->lr_res_matched = NULL;
- }
-
- if ( lr->lr_res_error != NULL ) {
- LDAP_FREE( lr->lr_res_error );
- lr->lr_res_error = NULL;
- }
- }
- }
- }
-
- /* All results that just return a status, i.e. don't return data
- * go through the following code. This code also chases V2 referrals
- * and checks if all referrals have been chased.
- */
- if ( tag != LDAP_RES_SEARCH_ENTRY &&
- v3ref != V3REF_TOAPP &&
- tag != LDAP_RES_INTERMEDIATE )
- {
- /* For a v3 search referral/reference, only come here if already chased it */
- if ( ld->ld_version >= LDAP_VERSION2 &&
- ( lr->lr_parent != NULL ||
- LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) ) )
- {
- char *lr_res_error = NULL;
-
- tmpber = *ber; /* struct copy */
- if ( v3ref == V3REF_SUCCESS ) {
- /* V3 search reference or V3 referral
- * sucessfully chased. If this message
- * is a search result, then it has no more
- * outstanding referrals.
- */
- if ( tag == LDAP_RES_SEARCH_RESULT )
- refer_cnt = 0;