mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-27 03:20:22 +08:00
Free ber mem arrays in reverse order. (better for sl_free)
This commit is contained in:
parent
7e8ff6df6b
commit
23b63aac39
@ -403,7 +403,11 @@ ber_bvecfree_x( struct berval **bv, void *ctx )
|
||||
|
||||
BER_MEM_VALID( bv );
|
||||
|
||||
for ( i = 0; bv[i] != NULL; i++ ) {
|
||||
/* count elements */
|
||||
for ( i = 0; bv[i] != NULL; i++ ) ;
|
||||
|
||||
/* free in reverse order */
|
||||
for ( i--; i >= 0; i-- ) {
|
||||
ber_bvfree_x( bv[i], ctx );
|
||||
}
|
||||
|
||||
@ -708,7 +712,11 @@ ber_bvarray_free_x( BerVarray a, void *ctx )
|
||||
if (a) {
|
||||
BER_MEM_VALID( a );
|
||||
|
||||
for (i=0; a[i].bv_val; i++) {
|
||||
/* count elements */
|
||||
for (i=0; a[i].bv_val; i++) ;
|
||||
|
||||
/* free in reverse order */
|
||||
for (i--; i>=0; i--) {
|
||||
ber_memfree_x(a[i].bv_val, ctx);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user