Mercurial > SDL_sound_CoreAudio
comparison decoders/smpeg.c @ 517:0f5888f9aef7 stable-1.0
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 | 45614e2c1c81 |
children | 50bb9a6cebfe |
comparison
equal
deleted
inserted
replaced
515:c5f184b4b2cd | 517:0f5888f9aef7 |
---|---|
114 SMPEG *smpeg; | 114 SMPEG *smpeg; |
115 SMPEG_Info smpeg_info; | 115 SMPEG_Info smpeg_info; |
116 SDL_AudioSpec spec; | 116 SDL_AudioSpec spec; |
117 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | 117 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; |
118 SDL_RWops *refCounter; | 118 SDL_RWops *refCounter; |
119 const char *err = NULL; | |
119 | 120 |
120 output_version(); | 121 output_version(); |
121 | 122 |
122 /* | 123 /* |
123 * If I understand things correctly, MP3 files don't really have any | 124 * If I understand things correctly, MP3 files don't really have any |
169 * accept the contained data... | 170 * accept the contained data... |
170 */ | 171 */ |
171 RWops_RWRefCounter_addRef(refCounter); | 172 RWops_RWRefCounter_addRef(refCounter); |
172 smpeg = SMPEG_new_rwops(refCounter, &smpeg_info, 0); | 173 smpeg = SMPEG_new_rwops(refCounter, &smpeg_info, 0); |
173 | 174 |
174 if (SMPEG_error(smpeg)) | 175 err = SMPEG_error(smpeg); |
175 { | 176 if (err != NULL) |
177 { | |
178 __Sound_SetError(err); /* make a copy before SMPEG_delete()... */ | |
176 SMPEG_delete(smpeg); | 179 SMPEG_delete(smpeg); |
177 BAIL_MACRO(SMPEG_error(smpeg), 0); | 180 return(0); |
178 } /* if */ | 181 } /* if */ |
179 | 182 |
180 if (!smpeg_info.has_audio) | 183 if (!smpeg_info.has_audio) |
181 { | 184 { |
182 SMPEG_delete(smpeg); | 185 SMPEG_delete(smpeg); |