G
G G
let's say, in a function, malloc or calloc is called to allocate memory. the function returns a pointer to that allocated space.
question: once the function ends the only pointer to the allocated memory is that being assigned by the calling function.
question: freeing the pointer being assigned to from the returning function is the only one that needs to be freed in order to keep from having a memory leak?
question: once the function ends the only pointer to the allocated memory is that being assigned by the calling function.
question: freeing the pointer being assigned to from the returning function is the only one that needs to be freed in order to keep from having a memory leak?