We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 307

Summary: Crash when loading OGG files
Product: SDL_mixer Reporter: Geoff Carlton <gcarlton>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: unspecified   
Hardware: x86   
OS: Windows (XP)   

Description Geoff Carlton 2006-08-24 00:08:29 UTC
I've just found a memory crash bug that occurs with the latest SDL_mixer 1.2.7 on windows, when loading OGG files.  The bug is this:

load_ogg.c mallocs a buffer internally:
   *audio_buf = malloc(*audio_len)

mixer.c frees it via the SDL dll:
   SDL_FreeWAV(chunk->abuf)

This can cause a problem since memory is allocated in one dll and freed in another.  My solution was to hack around in mixer.c.  I added an "int owner" variable, set to 1 in the OGG switch case, and replaced the couple of SDL_FreeWAV calls with:
   if (owner) free(chunk->abuf) else SDL_FreeWAV(chunk->abuf)
Comment 1 Peter Mulholland 2006-10-03 09:07:30 UTC
I didn't get this bug, but I did recompile SDL.dll and SDL_mixer.dll with MSVC 2005, which my game also compiles with. Perhaps this compilers runtime handles this sort of issue.
Comment 2 Patrice Mandin 2006-12-27 15:40:05 UTC
Duplicate of bug 369?
http://bugzilla.libsdl.org/show_bug.cgi?id=369
Comment 3 Ryan C. Gordon 2007-02-13 02:55:23 UTC
Yes, this is a duplicate bug.

--ryan.



*** This bug has been marked as a duplicate of 369 ***