mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-11-21 01:04:44 +08:00
return empty pointers in case of failure
This commit is contained in:
parent
4bb3340cf6
commit
75c6d86e7a
@ -476,7 +476,7 @@ rdn_attr_value( const char * rdn )
|
||||
int
|
||||
rdn_attrs( const char * rdn_in, char ***ptypes, char ***pvalues)
|
||||
{
|
||||
char **parts, **p;
|
||||
char **parts, **p, **types = NULL, **values = NULL;
|
||||
|
||||
*ptypes = NULL;
|
||||
*pvalues = NULL;
|
||||
@ -496,14 +496,14 @@ rdn_attrs( const char * rdn_in, char ***ptypes, char ***pvalues)
|
||||
/* split each rdn part in type value */
|
||||
s = strchr( p[0], '=' );
|
||||
if ( s == NULL ) {
|
||||
charray_free( *ptypes );
|
||||
charray_free( *pvalues );
|
||||
charray_free( types );
|
||||
charray_free( values );
|
||||
charray_free( parts );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/* type should be fine */
|
||||
charray_add_n( ptypes, p[0], ( s-p[0] ) );
|
||||
charray_add_n( &types, p[0], ( s-p[0] ) );
|
||||
|
||||
/* value needs to be unescaped
|
||||
* (maybe this should be moved to ldap_explode_rdn?) */
|
||||
@ -513,12 +513,15 @@ rdn_attrs( const char * rdn_in, char ***ptypes, char ***pvalues)
|
||||
}
|
||||
}
|
||||
d[0] = '\0';
|
||||
charray_add( pvalues, s + 1 );
|
||||
charray_add( &values, s + 1 );
|
||||
}
|
||||
|
||||
/* free array */
|
||||
charray_free( parts );
|
||||
|
||||
*ptypes = types;
|
||||
*pvalues = values;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user