<i>I think the C standard library would be easier to work with if they would&#x27;ve taken this further, and required, for example, fclose(NULL) to be a no-op.</i><p>There&#x27;s always the counterargument that cleanup code that hides a missing allocation can mask bugs elsewhere, if for example a <i>FILE</i> * <i>debug</i> was never <i>fopen()</i>ed, only gets written to in exceptional cases, and <i>fclose(NULL)</i> ignores.