summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2024-10-01 21:07:56 +0800
committerFabio Estevam <festevam@gmail.com>2024-10-04 09:15:15 -0300
commit876f6de20aead2de6c55f58b2ecc45375238426c (patch)
tree1f7743adcd77f78edfc51e5654587f5e9c52a879
parentc820d330680bf8d1193e2557ab3e4c76a7dc9da4 (diff)
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 <ye.li@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r--drivers/mmc/fsl_esdhc_imx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index a3defe952b2..debfc78b7f0 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;
}