]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: fsl_esdhc_imx: Avoid resource leak
authorYe Li <ye.li@nxp.com>
Tue, 1 Oct 2024 13:07:56 +0000 (21:07 +0800)
committerFabio Estevam <festevam@gmail.com>
Fri, 4 Oct 2024 12:15:15 +0000 (09:15 -0300)
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>
drivers/mmc/fsl_esdhc_imx.c

index a3defe952b2eb0130a26af5cda93d2590a8ea794..debfc78b7f0934541f720be6e9ff67ed5907a768 100644 (file)
@@ -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;
        }