char *last2;
dr = LDAP_CALLOC( 1, sizeof(LDAPDerefRes) );
+ if ( dr == NULL ) {
+ ldap_derefresponse_free( drhead );
+ *drp2 = NULL;
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return ld->ld_errno;
+ }
dvp = &dr->attrVals;
tag = ber_scanf( ber, "{ao", &dr->derefAttr, &dr->derefVal );
LDAPDerefVal *dv;
dv = LDAP_CALLOC( 1, sizeof(LDAPDerefVal) );
+ if ( dv == NULL ) {
+ ldap_derefresponse_free( drhead );
+ LDAP_FREE( dr );
+ *drp2 = NULL;
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return ld->ld_errno;
+ }
tag = ber_scanf( ber, "{a[W]}", &dv->type, &dv->vals );
if ( tag == LBER_ERROR ) {
l = vl + ava->la_attr.bv_len + 1;
str = LDAP_MALLOC( l + 1 );
+ if ( str == NULL ) {
+ goto error_return;
+ }
AC_MEMCPY( str, ava->la_attr.bv_val,
ava->la_attr.bv_len );
str[ al++ ] = '=';
} else {
l = vl;
str = LDAP_MALLOC( l + 1 );
+ if ( str == NULL ) {
+ goto error_return;
+ }
}
if ( ava->la_flags & LDAP_AVA_BINARY ) {
if ( escapes == 0 ) {
if ( *retFlags & LDAP_AVA_NONPRINTABLE ) {
val->bv_val = LDAP_MALLOCX( len + 1, ctx );
+ if ( val->bv_val == NULL ) {
+ return( 1 );
+ }
+
AC_MEMCPY( val->bv_val, startPos, len );
val->bv_val[ len ] = '\0';
} else {
ber_len_t s, d;
val->bv_val = LDAP_MALLOCX( len + 1, ctx );
+ if ( val->bv_val == NULL ) {
+ return( 1 );
+ }
+
for ( s = 0, d = 0; d < len; ) {
if ( LDAP_DN_ESCAPE( startPos[ s ] ) ) {
s++;
ber_len_t s, d;
val->bv_val = LDAP_MALLOCX( len + 1, ctx );
+ if ( val->bv_val == NULL ) {
+ return( 1 );
+ }
+
for ( s = 0, d = 0; d < len; ) {
/*
* This point is reached only if escapes
ber_len_t s, d;
val->bv_val = LDAP_MALLOCX( len + 1, ctx );
+ if ( val->bv_val == NULL ) {
+ return( 1 );
+ }
+
for ( s = 0, d = 0; d < len; ) {
if ( LDAP_DN_ESCAPE( startPos[ s ] ) ) {
s++;
ber_len_t s, d;
val->bv_val = LDAP_MALLOCX( len + 1, ctx );
+ if ( val->bv_val == NULL ) {
+ return( 1 );
+ }
+
val->bv_len = len;
for ( s = d = 0; d < len; ) {
}
bv->bv_val = LDAP_MALLOCX( l + 1, ctx );
+ if ( bv->bv_val == NULL ) {
+ return LDAP_NO_MEMORY;
+ }
switch ( LDAP_DN_FORMAT( flags ) ) {
case LDAP_DN_FORMAT_LDAPV3:
if ( must_b64_encode == default_must_b64_encode ) {
must_b64_encode = ber_memalloc( sizeof( must_b64_encode_s ) * ( i + 2 ) );
+ if ( must_b64_encode == NULL ) {
+ return 1;
+ }
for ( i = 0; !BER_BVISNULL( &default_must_b64_encode[i].name ); i++ ) {
ber_dupbv( &must_b64_encode[i].name, &default_must_b64_encode[i].name );
if ( fp ) {
lfp = ber_memalloc( sizeof( LDIFFP ));
+ if ( lfp == NULL ) {
+ return NULL;
+ }
lfp->fp = fp;
lfp->prev = NULL;
}
lr->lr_lm = ber_memalloc_x( nmods * sizeof(LDAPMod) +
(nmods+1) * sizeof(LDAPMod*) +
(lr->lr_lines + nmods - idn) * sizeof(struct berval *), ctx );
+ if ( lr->lr_lm == NULL ) {
+ rc = LDAP_NO_MEMORY;
+ goto leave;
+ }
+
pmods = (LDAPMod **)(lr->lr_lm+nmods);
bvl = (struct berval **)(pmods+nmods+1);
}
lr->lr_mops = ber_memalloc_x( lr->lr_lines+1, ctx );
+ if ( lr->lr_mops == NULL ) {
+ rc = LDAP_NO_MEMORY;
+ goto leave;
+ }
+
lr->lr_mops[lr->lr_lines] = M_SEP;
if ( i > 0 )
lr->lr_mops[i-1] = M_SEP;
lr->lr_lm = ber_memalloc_x( nmods * sizeof(LDAPMod) +
(nmods+1) * sizeof(LDAPMod*) +
(lr->lr_lines + nmods - idn) * sizeof(struct berval *), ctx );
+ if ( lr->lr_lm == NULL ) {
+ rc = LDAP_NO_MEMORY;
+ goto leave;
+ }
+
pmods = (LDAPMod **)(lr->lr_lm+nmods);
bvl = (struct berval **)(pmods+nmods+1);
int i;
info->ldapai_extensions = LDAP_MALLOC(sizeof(char *) *
sizeof(features)/sizeof(LDAPAPIFeatureInfo));
+ if ( info->ldapai_extensions == NULL ) {
+ rc = LDAP_NO_MEMORY;
+ break;
+ }
for(i=0; features[i].ldapaif_name != NULL; i++) {
info->ldapai_extensions[i] =
LDAP_STRDUP(features[i].ldapaif_name);
+ if ( info->ldapai_extensions[i] == NULL ) {
+ rc = LDAP_NO_MEMORY;
+ break;
+ }
+ }
+ if ( features[i].ldapaif_name != NULL ) {
+ break; /* LDAP_NO_MEMORY */
}
info->ldapai_extensions[i] = NULL;
/* setting pushes the callback */
ldaplist *ll;
ll = LDAP_MALLOC( sizeof( *ll ));
+ if ( ll == NULL ) {
+ rc = LDAP_NO_MEMORY;
+ break;
+ }
+
ll->ll_data = (void *)invalue;
ll->ll_next = lo->ldo_conn_cbs;
lo->ldo_conn_cbs = ll;
* to parse.
*/
ber = ldap_alloc_ber_with_options( ld );
+ if ( ber == NULL ) {
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return -1;
+ }
+
if ( ber_sockbuf_ctrl( lc->lconn_sb, LBER_SB_OPT_DATA_READY, NULL ) ) ok = 1;
}
/* set up response chain */
/* Non-numerical OID ... */
int len = ss-savepos;
at->at_oid = LDAP_MALLOC(len+1);
+ if ( !at->at_oid ) {
+ ldap_attributetype_free(at);
+ return NULL;
+ }
+
strncpy(at->at_oid, savepos, len);
at->at_oid[len] = 0;
}
/* Non-numerical OID, ignore */
int len = ss-savepos;
oc->oc_oid = LDAP_MALLOC(len+1);
+ if ( !oc->oc_oid ) {
+ ldap_objectclass_free(oc);
+ return NULL;
+ }
+
strncpy(oc->oc_oid, savepos, len);
oc->oc_oid[len] = 0;
}
/* Non-numerical OID, ignore */
int len = ss-savepos;
cr->cr_oid = LDAP_MALLOC(len+1);
+ if ( !cr->cr_oid ) {
+ ldap_contentrule_free(cr);
+ return NULL;
+ }
+
strncpy(cr->cr_oid, savepos, len);
cr->cr_oid[len] = 0;
}