don't try and free mid_track_buf if it isn't allocated, if midi conversion doesn't work

This commit is contained in:
kreatordxx 2008-02-17 01:52:37 +00:00
parent 0840866baa
commit a1beb821ea
2 changed files with 5 additions and 2 deletions

View file

@ -3,6 +3,7 @@ D1X-Rebirth Changelog
20080217
--------
d1x-rebirth.xcodeproj, main/game.c, main/newmenu.c: get SDL Video build to work again
misc/hmp2mid.c: don't try and free mid_track_buf if it isn't allocated, if midi conversion doesn't work
20080213
--------

View file

@ -35,7 +35,8 @@
{\
if (PHYSFS_read(hmp_in, buf, 1, count) != (count)) \
{ \
d_free(mid_track_buf); \
if (mid_track_buf) \
d_free(mid_track_buf); \
return hmp_read_error; \
} \
/* notice that when we are not actually in the track reading code this \
@ -53,7 +54,8 @@
#define MID_WRITE(buf, count) \
if (PHYSFS_write(mid_out, buf, 1, count) != (count)) \
{ \
d_free(mid_track_buf); \
if (mid_track_buf) \
d_free(mid_track_buf); \
strncpy(hmp2mid_error, mid_write_error_templ, sizeof(hmp2mid_error)); \
strncat(hmp2mid_error, PHYSFS_getLastError(), \
sizeof(hmp2mid_error) - sizeof(mid_write_error_templ) + 1); \