From f8eb60ae3daed3b849b7735041d3ef7ceca4a8d7 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 21 Aug 2011 09:10:52 +0000 Subject: [PATCH] snd_mp3.c (S_MP3_CodecOpenStream): Don't Z_Free() stream's private data when not allocating on the zone. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@479 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/snd_mp3.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Quake/snd_mp3.c b/Quake/snd_mp3.c index cc8ec6cf..70963ba8 100644 --- a/Quake/snd_mp3.c +++ b/Quake/snd_mp3.c @@ -308,7 +308,7 @@ static int mp3_decode(snd_stream_t *stream, byte *buf, int len) i++; } p->cursamp++; - }; + } len -= donow; done += donow; @@ -483,7 +483,7 @@ static int mp3_madseek(snd_stream_t *stream, unsigned long offset) break; } } - }; + } return -1; } @@ -517,15 +517,17 @@ static snd_stream_t *S_MP3_CodecOpenStream (const char *filename) } #endif - if (mp3_startread(stream) < 0) - { - Con_Printf("%s is not a valid MP3 file.\n", filename); - Z_Free(stream->priv); - S_CodecUtilClose(&stream); - return NULL; - } + if (mp3_startread(stream) == 0) + return stream; - return stream; + Con_Printf("%s is not a valid mp3 file\n", filename); +#if 0 /*defined(CODECS_USE_ZONE)*/ + Z_Free(stream->priv); +#else + free(stream->priv); +#endif + S_CodecUtilClose(&stream); + return NULL; } static int S_MP3_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)