title: Freeing memory in caller or callee?
body: <p>A function (Say "fun()") allocates memory and returns the pointer to allocated memory.
  How should I make sure I that this memory is released. I can't release it immediately in function "fun()" as it is returned to caller.
  And what if fun() is part of library? Whose responsibility it is to free memory.
  In case of fopen(), the memory is released by fclose(). But in my case, "fun()" is called repeatedly. So I can not wait till end to release the memory.</p>