There is no question about this. That is clearly a bug (and a relatively recently introduced one). ANSI C requires that realloc(ptr,0) == free(ptr). The only thing that is optional is whether malloc(0) returns null or a block that can be freed.