X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fcomponent.c;h=3a7db96e5b07413d6b15ad7fed6eada5d25fd376;hb=447f3f746e59fc5b724b8dd8bfb1ec0e02cc8d9f;hp=56054bb5fc7943db531b85ffd51390ef63c4f1dc;hpb=c890c96d13c53cf0fa1d9580fea2ab47a2c8caa9;p=openldap diff --git a/servers/slapd/component.c b/servers/slapd/component.c index 56054bb5fc..3a7db96e5b 100644 --- a/servers/slapd/component.c +++ b/servers/slapd/component.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2003-2008 The OpenLDAP Foundation. + * Copyright 2003-2009 The OpenLDAP Foundation. * Portions Copyright 2004 by IBM Corporation. * All rights reserved. * @@ -212,7 +212,7 @@ dup_comp_filter_list ( int get_len_of_next_assert_value ( struct berval* bv, char separator ) { - int i = 0; + ber_len_t i = 0; while (1) { if ( (bv->bv_val[ i ] == separator) || ( i >= bv->bv_len) ) break; @@ -491,7 +491,10 @@ get_componentId( Operation *op, ComponentAssertionValue* cav, if ( op ) { *cid = op->o_tmpalloc( sizeof( ComponentId ), op->o_tmpmemctx ); } else { - *cid = malloc( sizeof( ComponentId ) ); + *cid = SLAP_MALLOC( sizeof( ComponentId ) ); + } + if (*cid == NULL) { + return LDAP_NO_MEMORY; } **cid = _cid; return LDAP_SUCCESS; @@ -564,7 +567,7 @@ get_component_reference( ca_comp_ref = op->o_tmpalloc( sizeof( ComponentReference ), op->o_tmpmemctx ); } else { - ca_comp_ref = malloc( sizeof( ComponentReference ) ); + ca_comp_ref = SLAP_MALLOC( sizeof( ComponentReference ) ); } if ( !ca_comp_ref ) return LDAP_NO_MEMORY; @@ -951,7 +954,7 @@ get_item( Operation *op, ComponentAssertionValue* cav, ComponentAssertion** ca, if ( op ) _ca = op->o_tmpalloc( sizeof( ComponentAssertion ), op->o_tmpmemctx ); else - _ca = malloc( sizeof( ComponentAssertion ) ); + _ca = SLAP_MALLOC( sizeof( ComponentAssertion ) ); if ( !_ca ) return LDAP_NO_MEMORY; @@ -1170,7 +1173,10 @@ parse_comp_filter( Operation* op, ComponentAssertionValue* cav, if ( op ) { *filt = op->o_tmpalloc( sizeof(f), op->o_tmpmemctx ); } else { - *filt = malloc( sizeof(f) ); + *filt = SLAP_MALLOC( sizeof(f) ); + } + if ( *filt == NULL ) { + return LDAP_NO_MEMORY; } **filt = f; }