+ LDAP_FREE(ld->ld_error);
+ }
+
+ ld->ld_error = LDAP_STRDUP(err);
+ } return LDAP_OPT_SUCCESS;
+
+ case LDAP_OPT_MATCHED_DN: {
+ char* err = (char *) invalue;
+
+ if(ld == NULL) {
+ /* need a struct ldap */
+ break;
+ }
+
+ if( ld->ld_matched ) {
+ LDAP_FREE(ld->ld_matched);