]> git.sur5r.net Git - openldap/commitdiff
ldap_parse_result should always free result when freeit is true.
authorKurt Zeilenga <kurt@openldap.org>
Fri, 26 Mar 2010 14:05:47 +0000 (14:05 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 26 Mar 2010 14:05:47 +0000 (14:05 +0000)
libraries/libldap/error.c

index 743688888809c5fe1385af7b4ff9178bacb24dad..68463ecb7580b77ce085a7166a0e0a718ae04177 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;
 }