}
}
- v2 = ch_malloc( len+i+sizeof("Referral:") );
+ v2 = SLAP_MALLOC( len+i+sizeof("Referral:") );
+ if( v2 == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR, "v2ref: SLAP_MALLOC failed", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "v2ref: SLAP_MALLOC failed", 0, 0, 0 );
+#endif
+ return NULL;
+ }
+
if( text != NULL ) {
strcpy(v2, text);
if( i ) {
len += sizeof("Referral:");
for( i=0; ref[i].bv_val != NULL; i++ ) {
- v2 = ch_realloc( v2, len + ref[i].bv_len + 1 );
+ v2 = SLAP_REALLOC( v2, len + ref[i].bv_len + 1 );
+ if( v2 == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR, "v2ref: SLAP_MALLOC failed", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "v2ref: SLAP_MALLOC failed", 0, 0, 0 );
+#endif
+ return NULL;
+ }
v2[len-1] = '\n';
AC_MEMCPY(&v2[len], ref[i].bv_val, ref[i].bv_len );
len += ref[i].bv_len;
size = i * sizeof(char *) + k;
if ( size > 0 ) {
char *a_flags;
- e_flags = ch_calloc ( 1, i * sizeof(char *) + k );
+ e_flags = SLAP_CALLOC ( 1, i * sizeof(char *) + k );
+ if( e_flags == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu SLAP_CALLOC failed\n",
+ conn ? conn->c_connid : 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "send_search_entry: SLAP_CALLOC failed\n", 0, 0, 0 );
+#endif
+ ber_free( ber, 1 );
+
+ send_ldap_result( conn, op, LDAP_OTHER,
+ NULL, "memory error",
+ NULL, NULL );
+ goto error_return;
+ }
a_flags = (char *)(e_flags + i);
memset( a_flags, 0, k );
for ( a = e->e_attrs, i=0; a != NULL; a = a->a_next, i++ ) {
* Reuse previous memory - we likely need less space
* for operational attributes
*/
- tmp = ch_realloc ( e_flags, i * sizeof(char *) + k );
+ tmp = SLAP_REALLOC ( e_flags, i * sizeof(char *) + k );
if ( tmp == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
vals[1].bv_val = NULL;
- e = (Entry *) ch_calloc( 1, sizeof(Entry) );
+ e = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) );
+
+ if( e == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "root_dse_info: SLAP_CALLOC failed", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "root_dse_info: SLAP_CALLOC failed", 0, 0, 0 );
+#endif
+ return LDAP_OTHER;
+ }
e->e_attrs = NULL;
e->e_name.bv_val = ch_strdup( LDAP_ROOT_DSE );
return EXIT_FAILURE;
}
- usr_attr = (Entry *) ch_calloc( 1, sizeof(Entry) );
+ usr_attr = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) );
+ if( usr_attr == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "read_root_dse_file: SLAP_CALLOC failed", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "read_root_dse_file: SLAP_CALLOC failed", 0, 0, 0 );
+#endif
+ return LDAP_OTHER;
+ }
usr_attr->e_attrs = NULL;
while( ldif_read_record( fp, &lineno, &buf, &lmax ) ) {