The current implementation of tmux's xfree() function explicitly fatals if the pointer passed to it NULL. However, the C standard says that passing NULL to free() should be a no-op.
Having looked at this, this is true of all the BSDs (*except* 3BSD) and Linux, and Darwin, etc. I think we're perfectly safe to not be so defensive [1]. This now doesn't make the implementor conscience of whether passing NULL to xfree() is going to break things. Indeed, the motivation for me doing this came about because I *didn't* check for just this case; which seemed a little odd. Note that I really couldn't be bothered to unwrap the calls from xfree() to just use free() directly, given this change just calls free() directly from xfree() without doing any other checking. Perhaps it doesn't matter though. It would be a lot of unnecessary noise, IMO, if it were to change. Kindly, -- Thomas Adam [1] http://www.winehq.org/pipermail/wine-patches/2006-October/031544.html Thomas Adam (1): Don't check for NULL before xfree() trunk/arguments.c | 12 ++++-------- trunk/array.h | 3 +-- trunk/cmd-command-prompt.c | 9 +++------ trunk/cmd-confirm-before.c | 3 +-- trunk/cmd-if-shell.c | 3 +-- trunk/cmd-string.c | 9 +++------ trunk/cmd.c | 27 +++++++++------------------ trunk/environ.c | 9 +++------ trunk/screen.c | 6 ++---- trunk/server-client.c | 19 ++++++------------- trunk/session.c | 6 ++---- trunk/status.c | 15 +++++---------- trunk/xmalloc.c | 2 -- 13 files changed, 40 insertions(+), 83 deletions(-) -- 1.7.10 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users