Skip to content
Snippets Groups Projects
Commit 75c6d86e authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

return empty pointers in case of failure

parent 4bb3340c
No related branches found
No related tags found
No related merge requests found
......@@ -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 );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment