This is the mail archive of the gdb-patches@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: [patch] Fix crash on NULL rl_prompt


On Tuesday 30 March 2010 16:57:28, Tom Tromey wrote:
> Jan> BTW don't you think xstrdup (NULL) should == NULL?  Like xmalloc
> Jan> (0) == NULL.

While it is implementation defined if malloc(0) returns NULL or
not, xmalloc(0) never returns NULL.  Quite the opposite.
It makes sure to never call malloc with size 0.
I don't think that xstrdup should special case NULL input.
It will tend to mask out bugs.  It isn't clear to me your
patch isn't doing so, FTR.  It could have been a readline
change only visible when using a more recent system
readline, instead of the version bundled with gdb, for
example.

-- 
Pedro Alves


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