vdec: avoid free block when block is in free list [1/1]
authorapollo.ling <apollo.ling@amlogic.com>
Fri, 18 Sep 2020 07:40:15 +0000 (15:40 +0800)
committerHui Zhang <hui.zhang@amlogic.com>
Sun, 20 Sep 2020 03:34:37 +0000 (20:34 -0700)
PD#SWPL-33580

Problem:
When mem block is in free list, the mem block is freed

Solution:
Avoid free mem block when block is in free list

Verify:
u212

Change-Id: I7884c78c2fbd7db826eda94419569b5873c5d14e
Signed-off-by: apollo.ling <apollo.ling@amlogic.com>
drivers/frame_provider/decoder/utils/vdec_input.c

index 481edd7eab888ec81dc21548a6fc3e3940733c09..4eed7dc909d7314d1ce701c9e6da9167e22e6680 100644 (file)
@@ -1071,8 +1071,8 @@ void vdec_input_release_chunk(struct vdec_input_s *input,
                if (block->free) {
                        vdec_input_del_block_locked(input, block);
                        block->free(block->priv, block->handle);
+                       kfree(block);
                }
-               kfree(block);
        } else if (block->chunk_count == 0 &&
                input->wr_block != block ) {/*don't free used block*/
                if (block->size < input->default_block_size) {