avfilter/vf_idet: factorize av_frame_free(&idet->prev)
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Jan 2015 19:24:03 +0000 (20:24 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Jan 2015 19:24:03 +0000 (20:24 +0100)
Found-by: Pascal Massimino <pascal.massimino@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/vf_idet.c

index c6ee8dbb334c0948953021f7b1e3991002d035f6..5430aba628fbb5f8113e39a3c381370c98182ae1 100644 (file)
@@ -249,6 +249,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
         return ff_filter_frame(ctx->outputs[0], picref);
     }
 
+    av_frame_free(&idet->prev);
+
     if(   picref->width  != link->w
        || picref->height != link->h
        || picref->format != link->format) {
@@ -256,13 +258,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
         link->dst->inputs[0]->w      = picref->width;
         link->dst->inputs[0]->h      = picref->height;
 
-        av_frame_free(&idet->prev);
         av_frame_free(&idet->cur );
         av_frame_free(&idet->next);
     }
 
-    if (idet->prev)
-        av_frame_free(&idet->prev);
     idet->prev = idet->cur;
     idet->cur  = idet->next;
     idet->next = picref;