说我有:
char **search_terms = malloc(sizeof(char *) * number_search_terms);
for (i=0; i < number_search_terms; i++)
search_terms[i] = malloc(MAX_LINE_LEN);
当我释放这段记忆时,是否足够
free(search_terms)
还是我必须先释放缓冲区中的每个元素,如下所示:
for (i=0; i < number_search_terms; i++)
free(search_terms[i]);
free(search_terms);