While I can not yet say why. The error would be in these lines than.
STRING* *all_wilds = (STRING**)sys_malloc(sizeof(STRING*) * (wilds++));
memset(all_wilds, 0, sizeof(STRING*) * wilds);
-The * use is unclear to me and a bit above my skill. Reference deference, point to pointer.. .
Edit - I would think
STRING* all_wilds = (STRING*)sys_malloc(sizeof(STRING*) * (wilds++));
But that I'm sure I'm wrong... Also the sys_* function is dependent on the nexus size. You can try -nx 500 or something for testing if that is the issue.
For a google
Invalid Memory Access
This error occurs when a read or write instruction references unallocated or deallocated memory.