I think I’ve seen warnings about this from static analysis tools in the past, but I can’t be certain.
I almost never write pure C code these days (ironically, the one exception in recent years has been the SDK for the Oso Memory Profiler </shamelessplug>), and my memory manager for all my C++ projects has a debug mode that catches things like this on the rare occasions they happen.