malloc 0

buf = malloc(0)     //buf为一个有效的地址

buf = malloc(1.5)     //buf为一个有效的地址

buf = malloc(-1)     //buf为NULL

free(NULL)       //编译不会报错,运行也没问题,不清楚是否存在影响
例如:
char *buf = NULL;
buf = malloc(4);
memset(buf,0,4);
free(buf)
buf = NULL;
free(buf);

原文地址:https://www.cnblogs.com/baiduboy/p/8427292.html