Hello,
my program works properly but valgrind tells me I am not freeing allocated memory. I think the problem is in realloc.
I am pretty sure I do something wrong with realloc, because I changed it a bit and valgrind noticed less errors (that the program wasn't working properly with less errors is another question).
Thank you very much!
My example:
char *str1;
str1 = malloc(15 * sizeof(char));
for (x;y;z){
//in this place I need to have str everytime clear - maybe new allocated
//realloc works properly, but memory (?)
str1 = realloc(NULL, 15 * sizeof(char));
str1 = <any data>;
processIt(str1); //processIt as a void func
}
free(str1);