有一个结构:
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
不知道警报应该怎么解决?