Free all three buffers in av1_free_cdef_linebuf()
Between av1_alloc_cdef_linebuf() and av1_free_cdef_linebuf(), the
sequence header may have changed, in particular, the number of planes
may have changed. So av1_free_cdef_linebuf() should assume there may be
three buffers to free.
Declare the for loop index variable 'plane' as int. It is not necessary
to declare it as uint8_t.
BUG=oss-fuzz:33030
Change-Id: I17bb2f8271bd91bc058aa4100122bf81b084c000
diff --git a/av1/common/alloccommon.c b/av1/common/alloccommon.c
index 1aa0251..5e0c9ce 100644
--- a/av1/common/alloccommon.c
+++ b/av1/common/alloccommon.c
@@ -53,9 +53,7 @@
}
void av1_free_cdef_linebuf(AV1_COMMON *const cm) {
- const int num_planes = av1_num_planes(cm);
-
- for (uint8_t plane = 0; plane < num_planes; plane++) {
+ for (int plane = 0; plane < MAX_MB_PLANE; plane++) {
if (cm->cdef_info.linebuf[plane] != NULL)
aom_free(cm->cdef_info.linebuf[plane]);
cm->cdef_info.linebuf[plane] = NULL;
@@ -74,7 +72,7 @@
if (is_frame_scaled) av1_free_cdef_linebuf(cm);
- for (uint8_t plane = 0; plane < num_planes; plane++) {
+ for (int plane = 0; plane < num_planes; plane++) {
if (cm->cdef_info.linebuf[plane] == NULL) {
const int stride =
luma_stride >>