Pushing for downstream standards to define more
Pushing for downstream standards to define more
Posted Jun 9, 2024 16:25 UTC (Sun) by Wol (subscriber, #4433)In reply to: Pushing for downstream standards to define more by excors
Parent article: Removing GFP_NOFS
following that link to the Microsoft definition, yes that is exactly what I remember.
So doing a "ptr = realloc(ptr, 0)" instead of a free would prevent double frees or access-after-free, so long as (a) you're using a Windows-compliant compiler, and (b) you don't make copies of ptr. Surely that would make masses of sense as a simple way of defensive coding!
Cheers,
Wol