Valgrind complains with “Invalid write of size 8”
This looks wrong: Should probably be: (spaces added for convenience). EDIT: Some additional explanation: When you say return_data[i]=… you are trying to write something into return_data[i]. Now, return_data is char**, so return_data[i] is char*. So you are writing a pointer into some location in memory. It looks like your pointers are 8 bytes long (which is fine), but you’ve only allocated 6 bytes: MAX_SOURCE_STRING+1. So … Read more