using malloc instead of new, in line with other allocations in the program