#include <malloc.h> is not portable. Should #include <stdlib.h> instead.