diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 0e5a89cae..63f808a32 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20100719 +-------- +misc/hmp.c: Did not close hmp after MIDI conversion which caused some unfree memory - fixed + 20100718 -------- SCsonstruct, d1x-rebirth.xcodeproj, arch/sdl/digi.c, arch/sdl/digi_mixer_music.c, include/cfile.h, include/hmp.h, include/hmp.c: Merged all HMP-related code into hmp.c/h; Also introduced new HMP to MIDI conversion functions based on JJFFE which use former Win32-related HMP-code - fixes some bugs in MIDI conversion and cleaner diff --git a/misc/hmp.c b/misc/hmp.c index e124f6950..142c0bd16 100644 --- a/misc/hmp.c +++ b/misc/hmp.c @@ -24,13 +24,13 @@ #define MIDIINT(x) SWAPINT(x) #define MIDISHORT(x) SWAPSHORT(x) #endif - -#ifdef _WIN32 -void hmp_stop(hmp_file *hmp); -#endif + +#ifdef _WIN32 +void hmp_stop(hmp_file *hmp); +#endif // READ/OPEN/CLOSE HMP - + void hmp_close(hmp_file *hmp) { int i; @@ -529,7 +529,10 @@ void hmp2mid(char *hmp_name, char *mid_name) return; mid = PHYSFSX_openWriteBuffered(mid_name); if (mid == NULL) + { + hmp_close(hmp); return; + } // write MIDI-header PHYSFS_write(mid, "MThd", 4, 1); mi = MIDIINT(6); @@ -556,5 +559,6 @@ void hmp2mid(char *hmp_name, char *mid_name) cfseek(mid, 0, SEEK_END); } + hmp_close(hmp); cfclose(mid); -} +}