From eb124e409bf38ef461fc951b22d5e848479b8289 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 1cfc12f6fa..fb2ae018eb 100644 --- a/libs/libvpx/vp9/common/vp9_onyxc_int.h +++ b/libs/libvpx/vp9/common/vp9_onyxc_int.h @@ -349,6 +349,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--;