Convert some malloc calls to new