]> git.sur5r.net Git - openldap/commitdiff
ldap_parse_result should always free result when freeit is true.
authorQuanah Gibson-Mount <quanah@openldap.org>
Thu, 15 Apr 2010 22:03:50 +0000 (22:03 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 15 Apr 2010 22:03:50 +0000 (22:03 +0000)
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;
 }