]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/extended.c
add a giant mutex around the ldapinfo structure to serialize chaining (need to check...
[openldap] / servers / slapd / back-ldap / extended.c
index 92ebf50034bac7f35d26c424b4f159b70775cd5c..fde2c489b013af76e0cd0ab009216fb2aa52f5e4 100644 (file)
@@ -135,6 +135,14 @@ retry:
                                        (char **)&rs->sr_matched,
                                        (char **)&rs->sr_text,
                                        NULL, NULL, 0 );
+                       if ( rs->sr_matched && rs->sr_matched[ 0 ] == '\0' ) {
+                               free( (char *)rs->sr_matched );
+                               rs->sr_matched = NULL;
+                       }
+                       if ( rs->sr_text && rs->sr_text[ 0 ] == '\0' ) {
+                               free( (char *)rs->sr_text );
+                               rs->sr_text = NULL;
+                       }
                        if ( rc == LDAP_SUCCESS ) {
                                if ( rs->sr_err == LDAP_SUCCESS ) {
                                        struct berval   newpw;
@@ -165,15 +173,17 @@ retry:
                        }
                }
                send_ldap_result( op, rs );
-               if ( rs->sr_matched ) {
-                       free( (char *)rs->sr_matched );
-               }
-               if ( rs->sr_text ) {
-                       free( (char *)rs->sr_text );
-               }
+               rc = -1;
+       }
+
+       /* these have to be freed anyway... */
+       if ( rs->sr_matched ) {
+               free( (char *)rs->sr_matched );
                rs->sr_matched = NULL;
+       }
+       if ( rs->sr_text ) {
+               free( (char *)rs->sr_text );
                rs->sr_text = NULL;
-               rc = -1;
        }
 
        if ( lc != NULL ) {