Did not close hmp after MIDI conversion which caused some unfree memory - fixed

This commit is contained in:
zicodxx 2010-07-19 17:05:41 +00:00
parent 9070771c47
commit 785fffca90
2 changed files with 14 additions and 6 deletions

View file

@ -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

View file

@ -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);
}
}