diff mbox series

media: venus: helpers: Fix memory leak in venus_helper_alloc_dpb_bufs

Message ID 20211205190415.19962-1-jose.exposito89@gmail.com
State New
Headers show
Series media: venus: helpers: Fix memory leak in venus_helper_alloc_dpb_bufs | expand

Commit Message

José Expósito Dec. 5, 2021, 7:04 p.m. UTC
Addresses-Coverity-ID: 1494120 ("Resource leaks")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/media/platform/qcom/venus/helpers.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Kieran Bingham Dec. 6, 2021, 9:49 a.m. UTC | #1
Hi José

Quoting José Expósito (2021-12-05 19:04:15)
> Addresses-Coverity-ID: 1494120 ("Resource leaks")

This was also recently posted by Ameer in https://lore.kernel.org/all/20211204205504.6550-1-amhamza.mgc@gmail.com/

Regards
--
Kieran

> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
> ---
>  drivers/media/platform/qcom/venus/helpers.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
> index 84c3a511ec31..344a42853898 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -197,6 +197,7 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
>  
>                 id = ida_alloc_min(&inst->dpb_ids, VB2_MAX_FRAME, GFP_KERNEL);
>                 if (id < 0) {
> +                       kfree(buf);
>                         ret = id;
>                         goto fail;
>                 }
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 84c3a511ec31..344a42853898 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -197,6 +197,7 @@  int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
 
 		id = ida_alloc_min(&inst->dpb_ids, VB2_MAX_FRAME, GFP_KERNEL);
 		if (id < 0) {
+			kfree(buf);
 			ret = id;
 			goto fail;
 		}