Use new[] instead of malloc