Freeing malloced structure in a function
I'm creating a source files containing buffer functionality that I want to use for my other library that I'm creating. It is working correctly but I'm having trouble getting rid of the buffer structure that I'm creating in one of the functions. The following snippets should help illustrate my problem: C header: //dbuffer.h ... typedef struct{ char *pStorage; int *pPosition; int next_position; int number_of_strings; int total_size; }DBUFF; ... C source: //dbuffer.c ... DBUFF* dbuffer_init(char *init_pArray) { //Find out how many elements the array contains int size = sizeof_pArray(init_pArray);