Skip to content

Commit

Permalink
fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
simo981 committed Apr 22, 2024
1 parent 0a19f82 commit 75bbcd8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ inline void print_out(char **arr, size_t size, size_t queue_pos)
char **copy_buff = (char **)malloc(sizeof(char *) * (strings_len - saved_len));
memcpy(copy_buff, all_strings + saved_len, sizeof(char *) * (strings_len - saved_len));
push_queue(f_buffer[queue_pos], copy_buff, (strings_len - saved_len));
for (size_t i = 0; i < saved_len; i++)
{
free(all_strings[i]);
}
}
else
{
Expand Down

0 comments on commit 75bbcd8

Please sign in to comment.