[iOS]: prevent crashing (EXC_BAD_ACCESS) when releasing FFMPEG context by adding NULL check on codec context pointer

This commit is contained in:
Yoshi Sugawara 2015-12-28 21:43:11 -05:00
parent 84216ba3c3
commit 73c04e59fa

View File

@ -374,9 +374,11 @@ struct Atrac {
#else
// Future versions may add other things to free, but avcodec_free_context didn't exist yet here.
avcodec_close(pCodecCtx);
av_freep(&pCodecCtx->extradata);
av_freep(&pCodecCtx->subtitle_header);
av_freep(&pCodecCtx);
if ( pCodecCtx != NULL ) {
av_freep(&pCodecCtx->extradata);
av_freep(&pCodecCtx->subtitle_header);
av_freep(&pCodecCtx);
}
#endif
av_free_packet(packet);
delete packet;