Search
j0ke.net Open Build Service
>
Projects
>
mozilla
>
MozillaThunderbird
> mozldap-charray_strdup.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File mozldap-charray_strdup.patch of Package MozillaThunderbird
--- directory/c-sdk/ldap/libraries/libldap/charray.c_orig 2008-10-28 14:12:34.000000000 +0100 +++ directory/c-sdk/ldap/libraries/libldap/charray.c 2008-10-28 14:36:05.000000000 +0100 @@ -191,7 +191,7 @@ */ char ** LDAP_CALL -ldap_str2charray( char *str, char *brkstr ) +ldap_str2charray( char *str_in, char *brkstr ) /* This implementation fails if brkstr contains multibyte characters. But it works OK if str is UTF-8 and brkstr is 7-bit ASCII. */ @@ -199,6 +199,12 @@ char **res; char *s; int i; + char *str; + + str = nsldapi_strdup( str_in ); + if ( str == NULL ) { + return NULL; + } i = 1; for ( s = str; *s; s++ ) { @@ -209,6 +215,7 @@ res = (char **)NSLDAPI_MALLOC( (i + 1) * sizeof(char *) ); if ( res == NULL ) { + NSLDAPI_FREE( str ); return NULL; } i = 0; @@ -221,11 +228,13 @@ for ( j = 0; j < (i - 1); j++ ) NSLDAPI_FREE( res[j] ); NSLDAPI_FREE( res ); + NSLDAPI_FREE( str ); return NULL; } } res[i] = NULL; + NSLDAPI_FREE( str ); return( res ); }