fix: file free dangling pointer
This commit is contained in:
+1
-1
@@ -123,7 +123,7 @@ void file_write(const char *path, const StringArray *lines) {
|
||||
fclose(file_pointer);
|
||||
}
|
||||
|
||||
void file_free(const File *file) {
|
||||
void file_free(File *file) {
|
||||
if (!file->error) {
|
||||
free(file->content);
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,6 +13,6 @@ void file_write(const char *path, const StringArray *lines);
|
||||
|
||||
void file_dump(const char *path, const char *content);
|
||||
|
||||
void file_free(const File *file);
|
||||
void file_free(File *file);
|
||||
|
||||
#endif /* FILE_H */
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ void project_reload(Project *project, void (*reload_callback)(unsigned int)) {
|
||||
}
|
||||
}
|
||||
|
||||
void project_free(const Project *project) {
|
||||
void project_free(Project *project) {
|
||||
for (unsigned int i = 0; i < project->frag_count; i++) {
|
||||
file_free(&project->fragment_shaders[i][0]);
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,6 +8,6 @@ void project_init(Project *project, const char *project_path,
|
||||
|
||||
void project_reload(Project *project, void (*reload_callback)(unsigned int));
|
||||
|
||||
void project_free(const Project *project);
|
||||
void project_free(Project *project);
|
||||
|
||||
#endif /* PROJECT_H */
|
||||
|
||||
Reference in New Issue
Block a user