Hi I have allocated memory to a pointer to a character array using malloc
Later on in this array, I put NULL values to divide and use it later.
tmp_argv_pipe[index] = (char *)malloc(sizeof(char) * strlen(yytext) + 1);
Now I want to deallocate the memory specified to it.
For a different array pointer, I use
and it works fine.
void free_memory(char *tmp_argv)
for(counter = 0; tmp_argv[counter] != NULL; counter++)
tmp_argv[counter] = NULL;
I tried passing one more argument to the function above that gives the length of tmp_argv_pipe and then give the condition as
It gives me segementation error when I do this.
tmp_argv[counter] != NULL || counter <= length