aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_yadif.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-07-15 11:16:53 +0200
committerAnton Khirnov <anton@khirnov.net>2012-07-22 09:14:05 +0200
commit1dc42050185d63c1de5d16146fbaee92640af187 (patch)
treee53dbbfc52894acf4efd526b9ddcaf1d0b87d94d /libavfilter/vf_yadif.c
parent80e4ed279b3abe9f5356e2b56255b2aa64527345 (diff)
downloadffmpeg-1dc42050185d63c1de5d16146fbaee92640af187.tar.gz
lavfi: check all avfilter_ref_buffer() calls for errors.
Diffstat (limited to 'libavfilter/vf_yadif.c')
-rw-r--r--libavfilter/vf_yadif.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index 1025ba12c7..db4956c2cc 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -224,14 +224,18 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
if (yadif->auto_enable && !yadif->cur->video->interlaced) {
yadif->out = avfilter_ref_buffer(yadif->cur, AV_PERM_READ);
+ if (!yadif->out)
+ return AVERROR(ENOMEM);
+
avfilter_unref_bufferp(&yadif->prev);
if (yadif->out->pts != AV_NOPTS_VALUE)
yadif->out->pts *= 2;
return ff_start_frame(ctx->outputs[0], yadif->out);
}
- if (!yadif->prev)
- yadif->prev = avfilter_ref_buffer(yadif->cur, AV_PERM_READ);
+ if (!yadif->prev &&
+ !(yadif->prev = avfilter_ref_buffer(yadif->cur, AV_PERM_READ)))
+ return AVERROR(ENOMEM);
yadif->out = ff_get_video_buffer(ctx->outputs[0], AV_PERM_WRITE | AV_PERM_PRESERVE |
AV_PERM_REUSE, link->w, link->h);
@@ -282,6 +286,9 @@ static int request_frame(AVFilterLink *link)
if (ret == AVERROR_EOF && yadif->next) {
AVFilterBufferRef *next = avfilter_ref_buffer(yadif->next, AV_PERM_READ);
+ if (!next)
+ return AVERROR(ENOMEM);
+
next->pts = yadif->next->pts * 2 - yadif->cur->pts;
start_frame(link->src->inputs[0], next);