Commit 7ffc723c authored by Howard Chu's avatar Howard Chu
Browse files

Cleanup, fix uninitialized vars

parent f7c1ef43
......@@ -328,7 +328,9 @@ bvarray_free(
{
int i;
for (i=0; a[i].bv_val; i++)
free(a[i].bv_val);
free(a);
if (a) {
for (i=0; a[i].bv_val; i++)
free(a[i].bv_val);
free(a);
}
}
......@@ -609,9 +609,9 @@ UTF8SubstringsassertionNormalize(
return nsa;
err:
free( nsa->sa_final.bv_val );
bvarray_free( nsa->sa_any );
free( nsa->sa_initial.bv_val );
if ( nsa->sa_final.bv_val ) free( nsa->sa_final.bv_val );
if ( nsa->sa_any )bvarray_free( nsa->sa_any );
if ( nsa->sa_initial.bv_val ) free( nsa->sa_initial.bv_val );
ch_free( nsa );
return NULL;
}
......@@ -1111,9 +1111,12 @@ retry:
if( idx >= left.bv_len ) {
/* this shouldn't happen */
free( nav );
ch_free( sub->sa_final.bv_val );
bvarray_free( sub->sa_any );
ch_free( sub->sa_initial.bv_val );
if ( sub->sa_final.bv_val )
ch_free( sub->sa_final.bv_val );
if ( sub->sa_any )
bvarray_free( sub->sa_any );
if ( sub->sa_initial.bv_val )
ch_free( sub->sa_initial.bv_val );
ch_free( sub );
return LDAP_OTHER;
}
......@@ -1146,9 +1149,9 @@ retry:
done:
free( nav );
if( sub != NULL ) {
free( sub->sa_final.bv_val );
bvarray_free( sub->sa_any );
free( sub->sa_initial.bv_val );
if ( sub->sa_final.bv_val ) free( sub->sa_final.bv_val );
if ( sub->sa_any ) bvarray_free( sub->sa_any );
if ( sub->sa_initial.bv_val ) free( sub->sa_initial.bv_val );
ch_free( sub );
}
*matchp = match;
......@@ -1511,9 +1514,9 @@ static int caseExactIgnoreSubstringsFilter(
}
if( nkeys == 0 ) {
free( sa->sa_final.bv_val );
bvarray_free( sa->sa_any );
free( sa->sa_initial.bv_val );
if ( sa->sa_final.bv_val ) free( sa->sa_final.bv_val );
if ( sa->sa_any ) bvarray_free( sa->sa_any );
if ( sa->sa_initial.bv_val ) free( sa->sa_initial.bv_val );
ch_free( sa );
*keysp = NULL;
return LDAP_SUCCESS;
......@@ -1626,9 +1629,9 @@ static int caseExactIgnoreSubstringsFilter(
ch_free( keys );
*keysp = NULL;
}
free( sa->sa_final.bv_val );
bvarray_free( sa->sa_any );
free( sa->sa_initial.bv_val );
if ( sa->sa_final.bv_val ) free( sa->sa_final.bv_val );
if ( sa->sa_any ) bvarray_free( sa->sa_any );
if ( sa->sa_initial.bv_val ) free( sa->sa_initial.bv_val );
ch_free( sa );
return LDAP_SUCCESS;
......
......@@ -131,8 +131,8 @@ value_match(
const char ** text )
{
int rc;
struct berval nv1;
struct berval nv2;
struct berval nv1 = { 0, NULL };
struct berval nv2 = { 0, NULL };
if( !mr->smr_match ) {
return LDAP_INAPPROPRIATE_MATCHING;
......@@ -165,8 +165,8 @@ value_match(
nv1.bv_val != NULL ? &nv1 : v1,
nv2.bv_val != NULL ? &nv2 : v2 );
free( nv1.bv_val );
free( nv2.bv_val );
if (nv1.bv_val ) free( nv1.bv_val );
if (nv2.bv_val ) free( nv2.bv_val );
return rc;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment