develooper Front page | perl.perl5.porters | Postings from March 2013

Re: [perl #117239] Re: [perl #117259] Re: Bleadperlv5.17.9-200-g0e0ab62breaks MLEHMANN/JSON-XS-2.33.tar.gz

Thread Previous | Thread Next
From:
bulk88
Date:
March 24, 2013 20:00
Subject:
Re: [perl #117239] Re: [perl #117259] Re: Bleadperlv5.17.9-200-g0e0ab62breaks MLEHMANN/JSON-XS-2.33.tar.gz
Message ID:
BLU0-SMTP17327B066AEAA0191C75AA4DFD60@phx.gbl
Konovalov, Vadim (Vadim)** CTR ** wrote:
>> It was clearly and unambiguously a patch. It wasn't in diff 
>> format, but it
>> was clearly indicating that to make your code more portable, you could
>> change  the line:
>>
>>     HE *hes [count];
>> to
>>     #if defined(__BORLANDC__) || defined(_MSC_VER) || 
>> defined(__STDC__)
>> 	HE **hes = Perl_malloc (count * sizeof (HE));
>>     #else
>> 	HE *hes [count];
>>     #endif
> 
> 1)
> an overlook - it should be 
>  	HE **hes = Perl_malloc (count * sizeof (HE*));
> 
> it appears that HE is larger than HE* and allocating more memory, hence
> misbehaviour is not noticed, but anyway, this isn't correct
> 
> 2) when that chunk of memory freed? TIA :)

alloca, it can never leak. A non-const length auto C array calls alloca 
anyway on C99 under the hood.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About