might as well free the NULL pointers as well - this is totally valid C and can simplify the code
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.