From 876f6de20aead2de6c55f58b2ecc45375238426c Mon Sep 17 00:00:00 2001 From: Ye Li Date: Tue, 1 Oct 2024 21:07:56 +0800 Subject: [PATCH] mmc: fsl_esdhc_imx: Avoid resource leak The memory of priv and plat are leaked if max_bus_width is wrong. Signed-off-by: Ye Li Reviewed-by: Peng Fan Signed-off-by: Peng Fan --- drivers/mmc/fsl_esdhc_imx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index a3defe952b..debfc78b7f 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -1327,6 +1327,8 @@ int fsl_esdhc_initialize(struct bd_info *bis, struct fsl_esdhc_cfg *cfg) break; default: printf("invalid max bus width %u\n", cfg->max_bus_width); + free(plat); + free(priv); return -EINVAL; } -- 2.39.5