Skip to content

Commit

Permalink
FF7: Fix memory leak
Browse files Browse the repository at this point in the history
Fixes #768
  • Loading branch information
julianxhokaxhiu committed Feb 1, 2025
1 parent 072b6c0 commit a705a42
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ff7/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,11 @@ int ff7_read_field_file(char* path)
uint32_t size = lgp_get_filesize(lgp_file, 1);
char* dest = (char*)driver_malloc(size);
char* original_field_data = (char*)driver_malloc(*ff7_externals.known_field_buffer_size);
if ( !ff7_externals.field_file_buffer ) return 0;
if ( !ff7_externals.field_file_buffer )
{
driver_free(original_field_data);
return 0;
}

lgp_read_file(lgp_file, 1, dest, size);
ff7_externals.lzss_decode(dest, original_field_data);
Expand Down

0 comments on commit a705a42

Please sign in to comment.