]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/error.c
ITS#6510
[openldap] / libraries / libldap / error.c
index 9098aa5afee3979f406e1982c826a39d15a7737d..b0d5d3cda1234163ecd8b5be3274274067dc78b2 100644 (file)
@@ -281,11 +281,11 @@ ldap_parse_result(
        }
 
        if( lm == NULL ) {
-               ld->ld_errno = LDAP_NO_RESULTS_RETURNED;
+               errcode = ld->ld_errno = LDAP_NO_RESULTS_RETURNED;
 #ifdef LDAP_R_COMPILE
                ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
 #endif
-               return ld->ld_errno;
+           goto done;
        }
 
        if ( ld->ld_error ) {
@@ -391,12 +391,14 @@ ldap_parse_result(
                }
        }
 
-       if ( freeit ) {
-               ldap_msgfree( r );
-       }
 #ifdef LDAP_R_COMPILE
        ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
 #endif
 
-       return( errcode );
+done:
+       if ( freeit ) {
+               ldap_msgfree( r );
+       }
+
+       return errcode;
 }