[Development] QtCore missing check for memory allocation

Thiago Macieira thiago.macieira at intel.com
Fri Feb 27 18:27:40 CET 2015


On Friday 27 February 2015 11:15:03 Al-Khanji Louai wrote:
> In that case they cannot be overwritten without a recompile. Which brings me
> back to my original comment from yesterday (to which no one replied):
> 
> How is that different from linking a custom implementation of operator
> new/operator delete and malloc/free into Qt?

It isn't.

That's a MUCH easier solution: just replace malloc and make it abort() on 
failure instead of returning NULL.

This has the following advantages:
 * works for ALL libraries in the process, whether they handle malloc failures 
or not
 * works for operator new of all forms, since they just call malloc
 * requires no code change anywhere

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list