From 1499acac9ddf8fd0ae2ce91a3a8ef2cd715b1f48 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 12 Jan 2022 20:07:20 +0300 Subject: [PATCH] [libvpx] scan-build: avoid dereference of null pointer --- libs/libvpx/vp9/common/vp9_onyxc_int.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/libvpx/vp9/common/vp9_onyxc_int.h b/libs/libvpx/vp9/common/vp9_onyxc_int.h index 662b8ef5e1..c5b98c0021 100644 --- a/libs/libvpx/vp9/common/vp9_onyxc_int.h +++ b/libs/libvpx/vp9/common/vp9_onyxc_int.h @@ -299,6 +299,8 @@ static INLINE int get_free_fb(VP9_COMMON *cm) { static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) { const int ref_index = *idx; + if (!bufs) return; + if (ref_index >= 0 && bufs[ref_index].ref_count > 0) bufs[ref_index].ref_count--;