plug leaks

This commit is contained in:
Howard Chu 2006-03-31 20:36:53 +00:00
parent 0b72c15e52
commit 8c4711e9db
4 changed files with 27 additions and 7 deletions

View File

@ -1024,7 +1024,7 @@ int ldap_pvt_sasl_secprops(
sasl_security_properties_t *secprops )
{
int i, j, l;
char **props = ldap_str2charray( in, "," );
char **props;
unsigned sflags = 0;
int got_sflags = 0;
sasl_ssf_t max_ssf = 0;
@ -1034,7 +1034,11 @@ int ldap_pvt_sasl_secprops(
unsigned maxbufsize = 0;
int got_maxbufsize = 0;
if( props == NULL || secprops == NULL ) {
if( secprops == NULL ) {
return LDAP_PARAM_ERROR;
}
props = ldap_str2charray( in, "," );
if( props == NULL ) {
return LDAP_PARAM_ERROR;
}

View File

@ -1414,16 +1414,20 @@ add_extension(LDAPSchemaExtensionItem ***extensions,
if ( !*extensions ) {
*extensions =
LDAP_CALLOC(2, sizeof(LDAPSchemaExtensionItem *));
if ( !*extensions )
return 1;
if ( !*extensions ) {
LDAP_FREE( ext );
return 1;
}
n = 0;
} else {
for ( n=0; (*extensions)[n] != NULL; n++ )
;
tmp = LDAP_REALLOC(*extensions,
(n+2)*sizeof(LDAPSchemaExtensionItem *));
if ( !tmp )
if ( !tmp ) {
LDAP_FREE( ext );
return 1;
}
*extensions = tmp;
}
(*extensions)[n] = ext;

View File

@ -205,6 +205,10 @@ get_modlist(
6 ) == 0 ) {
if ( file_read( tmp.mod_values[i] + 6,
bvals[i] ) < 0 ) {
free( bvals );
for ( i = 0; i<num; i++ )
free( result[ i ] );
free( result );
return( NULL );
}
} else {

View File

@ -1309,12 +1309,18 @@ ldap_url_parsehosts(
specs[i] = ludp->lud_host;
ludp->lud_host = p;
p = strchr( ludp->lud_host, ']' );
if ( p == NULL )
if ( p == NULL ) {
LDAP_FREE(ludp);
ldap_charray_free(specs);
return LDAP_PARAM_ERROR;
}
*p++ = '\0';
if ( *p != ':' ) {
if ( *p != '\0' )
if ( *p != '\0' ) {
LDAP_FREE(ludp);
ldap_charray_free(specs);
return LDAP_PARAM_ERROR;
}
p = NULL;
}
} else {
@ -1328,6 +1334,8 @@ ldap_url_parsehosts(
ldap_pvt_hex_unescape(p);
ludp->lud_port = strtol( p, &next, 10 );
if ( next == p || next[0] != '\0' ) {
LDAP_FREE(ludp);
ldap_charray_free(specs);
return LDAP_PARAM_ERROR;
}
}