[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: leaks



> In looking at it, I have a question on one bit:
>
> op.o_req_dn.bv_val is freed by ch_free in the first & third group of
> changes, but is freed by sl_free in the second and fourth group of
> changes.
> Is that correct?
>
>>From the patch (1st & 3rd group):
>
>  if( !BER_BVISNULL( &op.o_req_dn ) ) ch_free( op.o_req_dn.bv_val );
>
>>From the patch (2nd & 4th group):
>
>  if( !BER_BVISNULL( &op.o_req_dn ) ) sl_free( op.o_req_dn.bv_val,
> opx->o_tmpmemctx );

It's intended; in fact, if o_req_dn ever gets filled, it's with memory
from ch_*alloc() routines, so it needs be ch_free()'d and replaced by
memory from sl_*alloc() routines.  We need to do so, because the
subsequent call to be_search() could muck with that memory, which is
always supposed to be from sl_*alloc(); then we need to sl_free() it.

p.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it


    SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497