i guess if i'm not allocating an object malloc should work just fine because i don't need to call o constructor.
Yes - in this case. But why not get into the habit of always using new/delete - or even better unique_ptr/shared_ptr.