diff --git a/tools/fc_sort/fc_sort.c b/tools/fc_sort/fc_sort.c index 5561288ad589ca1bf954a3bdbc1de10909a767ab..9a3a3ee14974ccb06c388dd8228372f032d8b4bb 100644 --- a/tools/fc_sort/fc_sort.c +++ b/tools/fc_sort/fc_sort.c @@ -350,6 +350,7 @@ int main(int argc, char *argv[]) /* Parse the file into a file_context linked list. */ line_buf = NULL; + buf_len = 0; while ( getline(&line_buf, &buf_len, in_file) != -1 ){ line_len = strlen(line_buf); @@ -478,15 +479,13 @@ int main(int argc, char *argv[]) current->next = temp; current = current->next; lines++; - - - free(line_buf); - line_buf = NULL; } + free(line_buf); fclose(in_file); /* Create the bucket linked list from the earlier linked list. */ current = head->next; + free(head); bcurrent = master = (file_context_bucket_t *) malloc(sizeof(file_context_bucket_t));