The code looks something like this
void otherfunc(char* str) {
str = malloc(128);
// Initialize str to something
}
void mainfunc() {
char* foo = NULL;
otherfunc(foo);
free(foo);
}
Ideally, foo should be freed, right? I'm not sure why this is leaking.
Also, if I move the free() to otherfunc it does not leak.