On Sun, Aug 25, 2019 at 02:58:47PM +0200, Otto Moerbeek wrote: > On Sun, Aug 25, 2019 at 08:32:04PM +0800, Michael Mikonos wrote: > > > Hello, > > > > I noticed that flex is too trusting and assumes > > calloc/malloc will always succeed. Hopefully I > > caught all of them. > > I tried to follow the existing idiom of > > calling flexerror() and passing strings via > > the _() macro. OK? > > Does upstream have anything like this? You could consider using the > xmalloc idiom (i.e. have separate functions that do the checks).
Upstream has the _() macro and also calls flexerror() on allocation failure. To me it is also nicer adding an xmalloc/xcalloc. That would be a bigger patch though as the calls currently checking malloc/calloc return value get modified too. - Michael
