> Actually it seems it is portable that free(NULL) is a no-op, so #1
> is the way to go.
It's common, but not necessary; free(NULL) falls into undefined
behavior, and it's possible that some cases may cause nasal demons.
Older versions of dmalloc errored by default on it, for instance.
That said, I don't offhand know of any current or not-so-current
system malloc implementation that chokes on it.
> Actually it seems it is portable that free(NULL) is a no-op, so #1
> is the way to go.
It's common, but not necessary; free(NULL) falls into undefined
behavior, and it's possible that some cases may cause nasal demons.
Older versions of dmalloc errored by default on it, for instance.
That said, I don't offhand know of any current or not-so-current
system malloc implementation that chokes on it.