changeset 518:16cbfcb8d7fb

Fixed bogus memory deference when SMPEG fails init (thanks, Chris!).
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 29 Oct 2006 07:14:48 +0000
parents 46d5f399cb35
children 64ae7ac242b9
files CHANGELOG CREDITS decoders/smpeg.c
diffstat 3 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Sat Oct 28 00:57:10 2006 +0000
+++ b/CHANGELOG	Sun Oct 29 07:14:48 2006 +0000
@@ -2,6 +2,7 @@
  * CHANGELOG.
  */
 
+10292006 - Fixed bogus memory deference when SMPEG fails init (thanks, Chris!)
 10272006 - FLAC 1.1.3 breaks their API _again_, so we try to do the right
            thing at build time. (Thanks, Josh!).
 07282006 - Ogg Vorbis decoding defaults to system byte order now.
--- a/CREDITS	Sat Oct 28 00:57:10 2006 +0000
+++ b/CREDITS	Sun Oct 29 07:14:48 2006 +0000
@@ -56,6 +56,9 @@
 FLAC 1.1.3 updates:
     Josh Coalson
 
+SMPEG fixes:
+    Chris Nelson
+
 Other stuff:
     Your name here! Patches go to icculus@clutteredmind.org ...
 
--- a/decoders/smpeg.c	Sat Oct 28 00:57:10 2006 +0000
+++ b/decoders/smpeg.c	Sun Oct 29 07:14:48 2006 +0000
@@ -116,6 +116,7 @@
     SDL_AudioSpec spec;
     Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
     SDL_RWops *refCounter;
+    const char *err = NULL;
 
     output_version();
 
@@ -171,10 +172,12 @@
     RWops_RWRefCounter_addRef(refCounter);
     smpeg = SMPEG_new_rwops(refCounter, &smpeg_info, 0);
 
-    if (SMPEG_error(smpeg))
+    err = SMPEG_error(smpeg);
+    if (err != NULL)
     {
+        __Sound_SetError(err);  /* make a copy before SMPEG_delete()... */
         SMPEG_delete(smpeg);
-        BAIL_MACRO(SMPEG_error(smpeg), 0);
+        return(0);
     } /* if */
 
     if (!smpeg_info.has_audio)