Hi, Not from a maintainer but from one following this thread with interest after I too noticed malloc calls as unchecked function call parameters, something that made me gasp a little being mainly an embedded programmer.
I would vote for... > [] Check the result of malloc: Actually, I would vote for check the result of everything unless you absolutely know what to expect (which is quite rare I think), it's just good defensive practice IMHO. > [] Create a malloc replacement that calls malloc > itself and kill the app if malloc return NULL. Definitely not this one. Because sometimes if malloc returns NULL it's not a fatal thing. You might have several algorithms doing the same job, one that uses a lot of memory which is used in preference if that memory is available and another perhaps less efficient one to fall back on if you can't have that amount of memory. Killing the app is not a good idea I think. Again this is probably me thinking "embedded" rather than PC. -- Liam. ----- Original Message ----- From: "Carsten Breuer" <carstenbreueropen...@textwork.de> To: <Openocd-development@lists.berlios.de> Sent: Thursday, December 17, 2009 8:44 PM Subject: [Openocd-development] malloc: Vote what to do > Hi all, > > > after finding out, that malloc come back with NULL > even on linux (where people says here, it don't), > im starting to loose interest in the hole thing. > > So what should we do? > > I think now, that all this arguments not to check > malloc result is academical and some arguments are not > even true. > > We have three solutions right now: > > [] Check the result of malloc: > [] Create a malloc replacement that calls malloc > itself and kill the app if malloc return NULL. > [] Leave it as it is. > > > I want a maintainer decision on that. > > > Best Regards, > > > > Carsten > _______________________________________________ > Openocd-development mailing list > Openocd-development@lists.berlios.de > https://lists.berlios.de/mailman/listinfo/openocd-development > _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development