[MPlayer-cvslog] r35293 - trunk/sub/av_sub.c
reimar
subversion at mplayerhq.hu
Tue Oct 30 18:14:28 CET 2012
Author: reimar
Date: Tue Oct 30 18:14:28 2012
New Revision: 35293
Log:
Move check for NULL to before the pointer is used.
Modified:
trunk/sub/av_sub.c
Modified: trunk/sub/av_sub.c
==============================================================================
--- trunk/sub/av_sub.c Tue Oct 30 18:09:14 2012 (r35292)
+++ trunk/sub/av_sub.c Tue Oct 30 18:14:28 2012 (r35293)
@@ -110,10 +110,15 @@ int decode_avsub(struct sh_sub *sh, uint
AVCodec *sub_codec;
init_avcodec();
ctx = avcodec_alloc_context3(NULL);
+ if (!ctx) {
+ mp_msg(MSGT_SUBREADER, MSGL_FATAL,
+ "Could not allocate subtitle decoder context\n");
+ return -1;
+ }
ctx->extradata_size = sh->extradata_len;
ctx->extradata = sh->extradata;
sub_codec = avcodec_find_decoder(cid);
- if (!ctx || !sub_codec || avcodec_open2(ctx, sub_codec, NULL) < 0) {
+ if (!sub_codec || avcodec_open2(ctx, sub_codec, NULL) < 0) {
mp_msg(MSGT_SUBREADER, MSGL_FATAL,
"Could not open subtitle decoder\n");
av_freep(&ctx);
More information about the MPlayer-cvslog
mailing list