std::{malloc, realloc, free} isn't portable. Use the good old ones from global namespace