changeset 34817:326242b21831

Do not return void type and remove broken duplicate code. The second copy of that code would only be run after we already tried to use mpi pointer, which means in the case it was supposed to handle we had already crashed.
author reimar
date Tue, 15 May 2012 21:18:39 +0000
parents 0640d4451aa7
children ec6877bfc79f
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Tue May 15 21:18:37 2012 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Tue May 15 21:18:39 2012 +0000
@@ -687,8 +687,10 @@
     sh_video_t *sh = avctx->opaque;
     vd_ffmpeg_ctx *ctx = sh->context;
     int i;
-    if (pic->type != FF_BUFFER_TYPE_USER)
-        return avcodec_default_release_buffer(avctx, pic);
+    if (pic->type != FF_BUFFER_TYPE_USER) {
+        avcodec_default_release_buffer(avctx, pic);
+        return;
+    }
 
 //printf("release buffer %d %d %d\n", mpi ? mpi->flags&MP_IMGFLAG_PRESERVE : -99, ctx->ip_count, ctx->b_count);
 
@@ -704,11 +706,6 @@
         mpi->usage_count--;
     }
 
-    if(pic->type!=FF_BUFFER_TYPE_USER){
-        avcodec_default_release_buffer(avctx, pic);
-        return;
-    }
-
     for(i=0; i<4; i++){
         pic->data[i]= NULL;
     }