From 9bd66d924bdc25d7e7d6885e9d5056b520509c4c Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Sun, 28 Apr 2002 20:15:05 +0000 Subject: [PATCH] fix for misparsing of sound length in "data" chunk of WAVE, this should fix stereo sound crashs git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1781 d7cf8633-e32d-0410-b094-e92efae38249 --- snd_mem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snd_mem.c b/snd_mem.c index 3290038e..a54e84c7 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -266,6 +266,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) sc = s->sfxcache = Mem_Alloc(s->mempool, len + sizeof(sfxcache_t)); if (!sc) { + Mem_FreePool(&s->mempool); Mem_Free(data); return NULL; } @@ -331,7 +332,7 @@ void FindNextChunk(char *name) data_p = NULL; return; } - + data_p += 4; iff_chunk_len = GetLittleLong(); if (iff_chunk_len < 0) @@ -455,7 +456,7 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) } data_p += 4; - samples = GetLittleLong () / info.width; + samples = GetLittleLong () / info.width / info.channels; if (info.samples) { -- 2.39.2