On Fri, Jul 01, 2011 at 06:05:07AM +0200, Stefan Tauner wrote: > compile tested only. > btw... why dont we wrap malloc to automatically include these checks? > there is probably a patch somewhere that adds totally awesome shutdown code > in OOM cases, > but afaics we just print a warning and exit right now... it is just stupid to > do the checks in the real > code then. > > Signed-off-by: Stefan Tauner <[email protected]>
It's definately better than what we have now (no error checking at all), so: Acked-by: Uwe Hermann <[email protected]> A few notes for later though: - We should call any shutdown function which may need to be called in the respective places (and any free()s which may be needed). - Later we should not exit(1) upon the error, but rather return an error code instead (e.g. FL_ERR_MALLOC or similar), at least in all public "API" functions which are meant to be in the upcoming libflashrom. - A small xmalloc() wrapper (or use another name) would indeed be nice, too, but once we really return error codes etc. it's not really useful anymore I think. Uwe. -- http://hermann-uwe.de | http://sigrok.org http://randomprojects.org | http://unmaintained-free-software.org _______________________________________________ flashrom mailing list [email protected] http://www.flashrom.org/mailman/listinfo/flashrom
