From: lordhavoc Date: Sun, 28 Apr 2002 20:15:05 +0000 (+0000) Subject: fix for misparsing of sound length in "data" chunk of WAVE, this should fix stereo... X-Git-Tag: RELEASE_0_2_0_RC1~530 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=9bd66d924bdc25d7e7d6885e9d5056b520509c4c 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 --- 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) {