When you allocate memory with malloc, it does not call the constructor of the class/struct. So you are dereferencing an uninitialized memory block that could be anything.
Instead of using malloc, you need to allocate with new.
The reason the second insert is not failing is because when you allocate an object on the stack without explicitly calling a constructor, the default constructor is called automatically.