diff decoders/smpeg.c @ 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 3e705c9180e5
children 2df1f5c62d38
line wrap: on
line diff
--- 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)