I have a C program that often uses char *str[xx] staff. Some lines are filled with the assignment operator (=) and do not need to be freed. But some others (in the same array) are populated with strdup() , which should be freed at the end of the program:
char * str [10];
str [I] = "Hello";
str [k] = strdup ("hello");
both line pointers are not null , and releasing str [i] will naturally generate a "seg fault". My problem is that at the end of my program, I do not have a track whose pointer points to the line generated by strdup() . can you help me, how can I find the string generated by strdup so that I can free them? thanks
source share