case BvVec:
bvp = ber_memalloc_x( sizeof( struct berval ), b->ber->ber_memctx);
if ( !bvp ) {
- LBER_FREE(bv.bv_val);
+ ber_memfree_x( bv.bv_val, b->ber->ber_memctx );
goto nomem;
}
(*b->res.bv)[n] = bvp;
for (--n; n>=0; n--) {
switch(b->choice) {
case ChArray:
- LBER_FREE((*b->res.c)[n]);
+ ber_memfree_x((*b->res.c)[n], b->ber->ber_memctx);
break;
case BvArray:
- LBER_FREE((*b->res.ba)[n].bv_val);
+ ber_memfree_x((*b->res.ba)[n].bv_val, b->ber->ber_memctx);
break;
case BvVec:
- LBER_FREE((*b->res.bv)[n]->bv_val);
- LBER_FREE((*b->res.bv)[n]);
+ ber_memfree_x((*b->res.bv)[n]->bv_val, b->ber->ber_memctx);
+ ber_memfree_x((*b->res.bv)[n], b->ber->ber_memctx);
break;
default:
break;
}
}
}
- LBER_FREE(*b->res.c);
+ ber_memfree_x(*b->res.c, b->ber->ber_memctx);
*b->res.c = NULL;
return LBER_DEFAULT;
}
if ( bv->bv_len > 0 && (ber_len_t) ber_read( ber, bv->bv_val,
bv->bv_len ) != bv->bv_len )
{
- LBER_FREE( bv->bv_val );
+ ber_memfree_x( bv->bv_val, ber->ber_memctx );
bv->bv_val = NULL;
return LBER_DEFAULT;
}
if ( bv->bv_len > 0 && (ber_len_t) ber_read( ber, bv->bv_val,
bv->bv_len ) != bv->bv_len )
{
- LBER_FREE( bv->bv_val );
+ ber_memfree_x( bv->bv_val, ber->ber_memctx );
bv->bv_val = NULL;
return LBER_DEFAULT;
}
tag = ber_get_stringbv( ber, *bv, LBER_BV_ALLOC );
if ( tag == LBER_DEFAULT ) {
- LBER_FREE( *bv );
+ ber_memfree_x( *bv, ber->ber_memctx );
*bv = NULL;
}
return tag;
}
if ( (ber_len_t) ber_read( ber, *buf, datalen ) != datalen ) {
- LBER_FREE( buf );
+ ber_memfree_x( buf, ber->ber_memctx );
*buf = NULL;
return LBER_DEFAULT;
}
case 'A':
ss = va_arg( ap, char ** );
if ( *ss ) {
- LBER_FREE( *ss );
+ ber_memfree_x( *ss, ber->ber_memctx );
*ss = NULL;
}
break;
case 'o': /* octet string in a supplied berval */
bval = va_arg( ap, struct berval * );
if ( bval->bv_val != NULL ) {
- LBER_FREE( bval->bv_val );
+ ber_memfree_x( bval->bv_val, ber->ber_memctx );
bval->bv_val = NULL;
}
bval->bv_len = 0;
case 'B': /* bit string - allocate storage as needed */
ss = va_arg( ap, char ** );
if ( *ss ) {
- LBER_FREE( *ss );
+ ber_memfree_x( *ss, ber->ber_memctx );
*ss = NULL;
}
*(va_arg( ap, ber_len_t * )) = 0; /* for length, in bits */