This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question, xmalloc and gdbserver?


On Tuesday 01 March 2011 23:25:27, Michael Snyder wrote:
> What's the policy about using malloc vs. xmalloc in gdbserver?
> I notice both are used, with xmalloc being favored, but there are
> still quite a few calls to malloc.

I think malloc is used when a failure is not to be considered
fatal, e.g., when the size of the data is determined by the input.

Doug went through and fixed a bunch a while ago (yearly 2009).
You should be able to find the discussions around the patches
in the archives.  Basically, if there's no explicit check
for NULL after malloc, then it's quite likely a new call
that went in after Doug's fixes.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]