X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Furl.c;h=c5a4e0650c7f12181aaac0a97e7b315a5601533a;hb=8f4f94d4152185f2e445ec0929787095ff15f922;hp=f61eb49d13169d215de77d74516a4e5c012a9682;hpb=4e5ed2dffc534d0ff0200a03e856838753fa74af;p=openldap diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index f61eb49d13..c5a4e0650c 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -24,7 +24,8 @@ #include "portable.h" #include -#include + +#include #include #include @@ -116,15 +117,15 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp ) } /* make working copy of the remainder of the URL */ - if (( url = strdup( url_tmp )) == NULL ) { + if (( url = LDAP_STRDUP( url_tmp )) == NULL ) { return( LDAP_URL_ERR_MEM ); } /* allocate return struct */ - if (( ludp = (LDAPURLDesc *)calloc( 1, sizeof( LDAPURLDesc ))) + if (( ludp = (LDAPURLDesc *)LDAP_CALLOC( 1, sizeof( LDAPURLDesc ))) == NULLLDAPURLDESC ) { - free( url ); + LDAP_FREE( url ); return( LDAP_URL_ERR_MEM ); } @@ -212,7 +213,7 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp ) } } - if (( ludp->lud_attrs = (char **)calloc( nattrs + 1, + if (( ludp->lud_attrs = (char **)LDAP_CALLOC( nattrs + 1, sizeof( char * ))) == NULL ) { ldap_free_urldesc( ludp ); return( LDAP_URL_ERR_MEM ); @@ -238,12 +239,12 @@ ldap_free_urldesc( LDAPURLDesc *ludp ) { if ( ludp != NULLLDAPURLDESC ) { if ( ludp->lud_string != NULL ) { - free( ludp->lud_string ); + LDAP_FREE( ludp->lud_string ); } if ( ludp->lud_attrs != NULL ) { - free( ludp->lud_attrs ); + LDAP_FREE( ludp->lud_attrs ); } - free( ludp ); + LDAP_FREE( ludp ); } } @@ -266,18 +267,18 @@ ldap_url_search( LDAP *ld, LDAP_CONST char *url, int attrsonly ) ludp->lud_filter, ludp->lud_attrs, attrsonly, NULL, NULL, -1, -1 ); - if ( ber == NULLBER ) { + if ( ber == NULL ) { return( -1 ); } err = 0; if ( ludp->lud_host != NULL || ludp->lud_port != 0 ) { - if (( srv = (LDAPServer *)calloc( 1, sizeof( LDAPServer ))) - == NULL || ( srv->lsrv_host = strdup( ludp->lud_host == + if (( srv = (LDAPServer *)LDAP_CALLOC( 1, sizeof( LDAPServer ))) + == NULL || ( srv->lsrv_host = LDAP_STRDUP( ludp->lud_host == NULL ? ld->ld_defhost : ludp->lud_host )) == NULL ) { if ( srv != NULL ) { - free( srv ); + LDAP_FREE( srv ); } ld->ld_errno = LDAP_NO_MEMORY; err = -1;