[U-Boot] [PATCH] Prevent malloc with size 0

Mike Frysinger
2010-10-22T15:18:05Z

On Friday, October 22, 2010 04:34:52 Joakim Tjernlund wrote:
> Don't you want to know if the app screwed up or if the system is out
> of memory?
>
> The only upside to malloc(0) == NULL I can see is an extra check
> for apps for which size == 0 is an error to the app too(something the app
> should have checked itself long before calling malloc).

if an app is doing malloc(0), it is broken. i'm really not worried at all
about detecting OOM state. my real world experience thus far has shown no
actual problems with this behavior. so unless you have some actual examples
where this behavior "harms" u-boot, i say we merge the OP's patch.

> hmm, "destroys quoted context", I think that is a new one. What
> exactly is destroyed?

it seems it fails to rewrap quoted lines and then when other people reply,
their clients arent able to recover thus screwing it up even more. pick any
msg from you in this thread. like this one:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/87174/focus=87290
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101022/5842be53/attachment.pgp