我有这样的结构
struct list
{
struct list *next;
int temp;
};
我用下面的方法来释放
…… …… ……
// free linked list
struct list *head_list = NULL;
struct list *current_list = NULL;
struct list *prev_list = NULL;
current_list = head_list;
while (current_file_info_arr != NULL)
{
prev_list = current_list;
current_list = current_list->next;
free(prev_list);
}
我收到警告
Memory error
Use of memory after it is freed
有什么好的解决办法吗?