Skip to contentSkip to conversation

media: atomisp: avoid memory leak in ia_css_pipe_create_cas_scaler_desc_single_output()

PATCH Superseded Alexandra Diupina 1 participant 1 message Dec 2, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: atomisp: avoid memory leak in ia_css_pipe_create_cas_scaler_desc_single_output()

ia_css_pipe_create_cas_scaler_desc_single_output() may fail, so add cleanup by ia_css_pipe_destroy_cas_scaler_desc() rather than simply exiting the function.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
---
 drivers/staging/media/atomisp/pci/sh_css.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +8 -2
index 73bd87f43a8c..4b553209af56 100644
@@ -4528,7 +4528,7 @@ static int load_video_binaries(struct ia_css_pipe *pipe)
 			  NULL,
 			  &cas_scaler_descr);
 		if (err)
-			return err;
+			goto ERR;
 		mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
 		mycs->yuv_scaler_binary = kcalloc(cas_scaler_descr.num_stage,
 						  sizeof(struct ia_css_binary),
@@ -4561,7 +4561,10 @@ static int load_video_binaries(struct ia_css_pipe *pipe)
 				return err;
 			}
 		}
+ERR:
 		ia_css_pipe_destroy_cas_scaler_desc(&cas_scaler_descr);
+		if (err)
+			return err;
 	}
 
 	{
@@ -5107,7 +5110,7 @@ static int load_primary_binaries(
 			  &cas_scaler_descr);
 		if (err) {
 			IA_CSS_LEAVE_ERR_PRIVATE(err);
-			return err;
+			goto ERR;
 		}
 		mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
 		mycs->yuv_scaler_binary = kcalloc(cas_scaler_descr.num_stage,
@@ -5141,7 +5144,10 @@ static int load_primary_binaries(
 				return err;
 			}
 		}
+ERR:
 		ia_css_pipe_destroy_cas_scaler_desc(&cas_scaler_descr);
+		if (err)
+			return err;
 
 	} else {
 		capt_pp_out_info = pipe->output_info[0];
Signature · 1 line
2.30.2