Skip to content

Commit

Permalink
Fix memory leak on unclosed folders in Compass MAK file
Browse files Browse the repository at this point in the history
  • Loading branch information
ojwb committed Mar 14, 2024
1 parent a673205 commit 32b24f9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/datain.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ data_file_compass_mak(void)
// Leave subdirectory.
struct mak_folder *p = folder_stack;
if (folder_stack == NULL) {
// FIXME: Report?
// FIXME: Error? Check what Compass does.
break;
}
s_truncate(&path, folder_stack->len);
Expand Down Expand Up @@ -1042,6 +1042,14 @@ data_file_compass_mak(void)
break;
}
}

while (folder_stack) {
// FIXME: Error? Check what Compass does.
struct mak_folder *next = folder_stack->next;
osfree(folder_stack);
folder_stack = next;
}

pop_settings();
s_free(&path);
}
Expand Down

0 comments on commit 32b24f9

Please sign in to comment.