This is a simple malloc debugger. It finds memory leaks, double free's, bad pointers and allows you to create malloc failures. Almost everyone has done at least one of these (I think I've written 3 or 4, with different "features").
This won't catch everything ... Ie. buffer overruns etc. but then it's better to just not write those.
All of the code is contained in the header files mk.h (947B) and malloc-check.h (8.20KB), just include it and use the 4 malloc wrapper APIs (MK(), M0(), MV() and F()). There are 5 tests to show how it works: mtest1 (248B), mtest2 (164B), mtest3 (240B), mtest4 (173B) and mtest5 (303B). There is also a Makefile (701B) which is probably simple enough it will build everywhere.