fix: project files free
This commit is contained in:
+1
-1
@@ -131,7 +131,7 @@ void file_write(const char *path, const StringArray *lines) {
|
||||
}
|
||||
|
||||
void file_free(File *file) {
|
||||
if (!file->error) {
|
||||
if (!file->error && file->content != NULL) {
|
||||
free(file->content);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -104,6 +104,12 @@ void project_init(Project *project, const char *project_path,
|
||||
|
||||
project->sub_counts.length = project->frag_count;
|
||||
|
||||
for (unsigned int i = 0; i < project->frag_count; i++) {
|
||||
for (unsigned int j = 0; j < MAX_SUB_FILE + 1; j++) {
|
||||
project->fragment_shaders[i][j].content = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < project->frag_count; i++) {
|
||||
project->sub_counts.values[i] = 0;
|
||||
if (!read_fragment_shader_file(project, frag_prefix, i)) {
|
||||
@@ -138,7 +144,9 @@ void project_reload(Project *project, void (*reload_callback)(unsigned int)) {
|
||||
|
||||
void project_free(Project *project) {
|
||||
for (unsigned int i = 0; i < project->frag_count; i++) {
|
||||
file_free(&project->fragment_shaders[i][0]);
|
||||
for (unsigned int j = 0; j < MAX_SUB_FILE + 1; j++) {
|
||||
file_free(&project->fragment_shaders[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
config_file_free(&project->config);
|
||||
|
||||
Reference in New Issue
Block a user