You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/01/29 03:50:18 UTC

Re: cvs commit: modperl-2.0/xs/APR/Brigade APR__Brigade.h

stas@apache.org wrote:
> stas        2004/01/28 18:44:33
> 
>   Modified:    xs/APR/Brigade APR__Brigade.h
>   Log:
>   avoid a memory leak if flatten() croaks by moving newSV until after croak.

Watch out for the clear and hidden behind macros croak calls after perl vars 
were created w/o being made mortal. If the function croaks we get a memory 
leak. So either move the creation after the croak, or make the variable mortal 
before the croak.

I think we still have several places that have this problem (probably most are 
my fault).

>   -    SV *data = newSV(0);
>   +    SV *data;
>    
>        mpxs_usage_va_1(bb, "$bb->flatten([$length])");
>    
>   @@ -125,6 +125,7 @@
>            length = (apr_size_t)actual;
>        }
>    
>   +    data = newSV(0);
>        mpxs_sv_grow(data, length);

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org