RTFM

http://weibo.com/1401880315/BnzEEyDnF?mod=weibotime

@1:
free(ptr):If ptr is a null pointer, no action occurs.

@2:
malloc(0):
Q: What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
A: The ANSI/ISO Standard says that it may do either; the behavior is implementation-defined. Portable code must either
take care not to call malloc(0), or be prepared for the possibility of a null return.

@3:
malloc(-1):
malloc(-1) returns NULL.

posted @ 2014-09-21 15:27  XiaoweiLiu  阅读(357)  评论(0编辑  收藏  举报