@$3.1415rin is right, if your code is C++ no need of struct PATH, the code looked like regular C.
Well then I see no problem in this code.
If only this map makes malloc crash then either the wp file for this map is corrupted in some way and you allocate too much wp or mem in other portion of code; or its a pointer problem somewhere messing stuff and you'll have a hard time finding it
* Since it's all C++ you could consider replacing all malloc/free with new/delete and see if it helps.
* If you are using static arrays in some places it's possible one of your index somewhere goes out of bounds in this particular map and write stuff at bad places.
* Or disable the waypoint code altogether and see if mem allocations in other portion of code cause the same problem with the same map or not.
This is some ideas to try, hope this helps.