Last active
April 19, 2017 19:57
-
-
Save windy1/c8878017911bf3009e2faa9207a3badf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void onFinish(SomeData *data) { | |
callback(data); | |
if (data->myData) { | |
// "pointer being freed was not allocated" | |
// debugger says address is different from before callback | |
free(data->myData); | |
} | |
} | |
void callback(SomeData *data) { | |
doStuff(*data); | |
} | |
void doStuff(SomeData data) { | |
char *buffer = (char*) malloc(numBytes); | |
memcpy(buffer, data.myData, numBytes); | |
// ...do stuff with buffer... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment