Bug 2604 - Crash in OpenAL music playing and memory leak in ogg decoder
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Sound
Version: 1.33 SVN
Hardware: All All
: P2 normal
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2006-02-26 11:52 EST by Thilo Schulz
Modified: 2007-05-21 11:25:05 EDT
1 user (show)

See Also:


Attachments
patch to fix the bugs (1.23 KB, patch)
2006-02-26 11:53 EST, Thilo Schulz

Description Thilo Schulz 2006-02-26 11:52:42 EST
There is a crash in snd_openal.c that exists when playing music.
It can be triggered when opening the sound file succeeded but the first read request to fill the openal buffer fails.
This will result in the opened sound stream being closed along with the codec structure which holds the functionpointers to the codec functions. The for loop will try to fill all buffers and uses the decoder functions every time for that, even if the stream is already closed. -> crash.

There is also a memory leak in the ogg decoder for sounds, not a big one though. When registering a sound, the engine tries to allocate space for the complete sound.
The function S_OGG_CodecLoad will take care of that. Normally the function returns a pointer to the allocated buffer, but if nothing is read due to an error, it will return a NULL pointer. Before returning NULL the allocated buffer won't get freed.

I fixed both bugs in my patch that is attached to this bug entry.
Comment 1 Thilo Schulz 2006-02-26 11:53:16 EST
Created attachment 840 [details]
patch to fix the bugs
Comment 2 Tim Angus 2006-02-28 11:01:06 EST
Woops, forgot to mark this as fixed.
Comment 3 Ryan C. Gordon 2007-05-21 11:25:05 EDT
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.

--ryan.