In any code that you write that dynamically allocates memory, you have 2 responsibilities regarding any allocated memory block: (1) always keep a pointer to the start address for the memory block, so (2) it can be freed when it is no longer needed. Freeing up your memory is up to you.
, , , ( 1 ), - .