Changes usage of new to malloc for better C compatibility