My program crashes when I try to assign a string value to a member of a structure.
My suspicion is that the member (of type string) within the structure was never properly alloc
malloc doesn't ensure any constructors of the members of your struct are called. In C++ struct is basically the same as class, the only difference is that members are public by default rather than private. So you should new the object/struct, and delete it when done.