Hi Roy,
The docs for HeapFree state "If this pointer is NULL, the behavior is undefined." So in practice the undefined behavior is benign?
Yes. There are tests for that, and in fact there's a janitorial project about removing redundant NULL pointer checks before HeapFree. Michael Stefaniuc wrote about it here: http://www.mail-archive.com/wine-devel@winehq.org/msg11972.html You'll still see occasional commits along those lines, often from Michael, tagged with "found by Smatch." E.g.: http://www.winehq.org/pipermail/wine-cvs/2007-November/038118.html
--Juan