I have a struct:
struct Foo
{
    std::unordered_map<std::string, std::string> info;
    int count;
    int bar;
}
I am trying to initialize this struct on the heap as follows:
Foo* createFoo(int count, int bar)
{
    Foo* foo = (Foo*)malloc(sizeof(Foo));
    foo->info = std::unordered_map<std::string, std::string>(); // <- exception thrown here
    foo->count = count;
    foo->bar = bar;
    return foo;
}
I am getting the following exception thrown upon construction of the unordered_map:
Exception thrown: read access violation. _Pnext was 0xCDCDCDD1.
I understand that MVS fills heap allocated memory with 0xCD which is why the _Pnext pointer has this value, but I don't understand why the unordered_map constructor isn't zero-ing these fields out.
I realize that the modern C++ way of doing this is with new/constructors but I am trying to write this code in a non-OOP procedural way with (basically) POD objects.
Am I initializing the map incorrectly?
 
     
     
     
    