No. Either: a) you wanted a zero-size allocation know not to use the pointer; or b) the zero size allocation was a bug and should be detected as a error that's distinct from a out of memory error (i.e., any attempted use should fault).
If you wish to defensively program a function against a caller requesting zero-sized allocations it would be better to test before attempting the allocation.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds