I suppose the implication is that, checking for null allows your cleanup logic to be more complex than simply calling free()
for example, the object could be managing an open file, or an open socket
for example, the object could be managing an open file, or an open socket
void my_thing_free(MyThing *thing) {
fclose(thing->file);
free(thing);
}
assuming an associated "my_thing_new" that only returns a valid pointer when both the allocation and the fopen succeeded.