Hi,
This patch is written for MSI, but could be adapted to other code. It keeps a linked list of allocated memory and removes free'd memory from the list.
It requires that you change all the HeapAlloc's or mallocs in a dll to msi_alloc (for example), but can detect unfree'd memory and invalid free's.
I have discovered quite a few problems in my own code with this patch, so hopefully somebody else will find it useful too.
Mike