[MPlayer-cvslog] r35350 - trunk/libmpcodecs/vf.c

reimar subversion at mplayerhq.hu
Mon Nov 5 21:58:38 CET 2012


Author: reimar
Date: Mon Nov  5 21:58:38 2012
New Revision: 35350

Log:
Fix crash when not able to find a mpi by using an
early return.

Modified:
   trunk/libmpcodecs/vf.c

Modified: trunk/libmpcodecs/vf.c
==============================================================================
--- trunk/libmpcodecs/vf.c	Mon Nov  5 21:53:49 2012	(r35349)
+++ trunk/libmpcodecs/vf.c	Mon Nov  5 21:58:38 2012	(r35350)
@@ -279,6 +279,7 @@ mp_image_t* vf_get_image(vf_instance_t* 
   mp_image_t* mpi=NULL;
   int w2;
   int number = (mp_imgtype >> 16) - 1;
+  int missing_palette;
 
 #ifdef MP_DEBUG
   assert(w == -1 || w >= vf->w);
@@ -344,8 +345,10 @@ mp_image_t* vf_get_image(vf_instance_t* 
     mpi->number = number;
     break;
   }
-  if(mpi){
-    int missing_palette = !(mpi->flags & MP_IMGFLAG_RGB_PALETTE) && (mp_imgflag & MP_IMGFLAG_RGB_PALETTE);
+
+  if (!mpi)
+    return NULL;
+
     mpi->type=mp_imgtype;
     mpi->w=vf->w; mpi->h=vf->h;
     // keep buffer allocation status & color flags only:
@@ -354,6 +357,7 @@ mp_image_t* vf_get_image(vf_instance_t* 
     // accept restrictions, draw_slice and palette flags only:
     mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_RGB_PALETTE);
     if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
+    missing_palette = !(mpi->flags & MP_IMGFLAG_RGB_PALETTE) && (mp_imgflag & MP_IMGFLAG_RGB_PALETTE);
     if(mpi->width!=w2 || mpi->height!=h || missing_palette){
 //      printf("vf.c: MPI parameters changed!  %dx%d -> %dx%d   \n", mpi->width,mpi->height,w2,h);
         if(mpi->flags&MP_IMGFLAG_ALLOCATED){
@@ -429,7 +433,6 @@ mp_image_t* vf_get_image(vf_instance_t* 
     }
 
   mpi->qscale = NULL;
-  }
   mpi->usage_count++;
   // TODO: figure out what is going on with EXPORT types
   if (mpi->usage_count > 1 && mpi->type != MP_IMGTYPE_EXPORT)


More information about the MPlayer-cvslog mailing list