Skip to contentSkip to conversation

media: venus: helpers: Fix memory leak in venus_helper_alloc_dpb_bufs

PATCH In review José Expósito 2 participants 2 messages Dec 5, 2021 – Dec 6, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: venus: helpers: Fix memory leak in venus_helper_alloc_dpb_bufs

Addresses-Coverity-ID: 1494120 ("Resource leaks")

---
 drivers/media/platform/qcom/venus/helpers.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/qcom/venus/helpers.c +1 -0
index 84c3a511ec31..344a42853898 100644
@@ -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;
 		}
Signature · 1 line
2.25.1
#1 lore raw

Hi José

Quoting José Expósito (2021-12-05 19:04:15)

Quoted 1 line

Addresses-Coverity-ID: 1494120 ("Resource leaks")

This was also recently posted by Ameer in https://lore.kernel.org/all/[email protected]/

Regards
--
Kieran

Quoted 20 lines
---
 drivers/media/platform/qcom/venus/helpers.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/qcom/venus/helpers.c +1 -0
index 84c3a511ec31..344a42853898 100644
@@ -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;
                }
Signature · 1 line
2.25.1