On 10 October 2014 15:20, Tomas Guisasola Gorham
<to...@tecgraf.puc-rio.br> wrote:
>         Hi Hisham and Philipp
>
>         I am not sure the pull request is a safe implementation since
> an error (not enough memory?) could occur after the malloc and before
> the free...  There is no way to let the compiler accept the problematic
> construction?  It would be not only safe but also a simpler code to read
> and maintain :-)

The current construct is not safer: if it runs out of stack space then
it will crash just like not checking the return of malloc would (and
running out of stack is more common than running out of heap space).
The proposed patch with a one-line addition to check the malloc would
make the code safer[*] and not that uglier: if (!to) return 0;

-- Hisham
[*] in principle, because making an entire library resilient to
out-of-memory failures is usually a lot of work...

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
Luarocks-developers mailing list
Luarocks-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to