diff mbox

[FFmpeg-devel,v1,1/2] avfilter/vf_libvmaf: Check for av_frame_alloc failure

Message ID 20191112105537.5542-1-lance.lmwang@gmail.com
State Accepted
Commit 8aa143eaa89cff7a72e2e9c80eb7fbac3b77e5be
Headers show

Commit Message

Lance Wang Nov. 12, 2019, 10:55 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/vf_libvmaf.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Paul B Mahol Nov. 12, 2019, 11:55 a.m. UTC | #1
LGTM

On 11/12/19, lance.lmwang@gmail.com <lance.lmwang@gmail.com> wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/vf_libvmaf.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
> index ed3a383..14c3216 100644
> --- a/libavfilter/vf_libvmaf.c
> +++ b/libavfilter/vf_libvmaf.c
> @@ -235,6 +235,9 @@ static av_cold int init(AVFilterContext *ctx)
>
>      s->gref = av_frame_alloc();
>      s->gmain = av_frame_alloc();
> +    if (!s->gref || !s->gmain)
> +        return AVERROR(ENOMEM);
> +
>      s->error = 0;
>
>      s->vmaf_thread_created = 0;
> --
> 2.9.5
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox

Patch

diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
index ed3a383..14c3216 100644
--- a/libavfilter/vf_libvmaf.c
+++ b/libavfilter/vf_libvmaf.c
@@ -235,6 +235,9 @@  static av_cold int init(AVFilterContext *ctx)
 
     s->gref = av_frame_alloc();
     s->gmain = av_frame_alloc();
+    if (!s->gref || !s->gmain)
+        return AVERROR(ENOMEM);
+
     s->error = 0;
 
     s->vmaf_thread_created = 0;