Reminder for the future: when we're using malloc() we MUST include <stdlib.h> as otherwise 64bit archs go bananas. Bug report #517687