diff options
author | Peng Fan <Peng.Fan@freescale.com> | 2015-11-26 10:26:59 +0800 |
---|---|---|
committer | guoyin.chen <guoyin.chen@freescale.com> | 2016-03-04 15:53:37 +0800 |
commit | 1a07d4585b0497f54bf2d127e5fb8ba7cfa2958a (patch) | |
tree | b9c2850b8d27134778a7309394501892b6fa47b0 /configs/at91sam9263ek_dataflash_cs0_defconfig | |
parent | bc26ac46150f1e84fa937c71a589ac957de316ee (diff) | |
download | u-boot-imx-1a07d4585b0497f54bf2d127e5fb8ba7cfa2958a.zip u-boot-imx-1a07d4585b0497f54bf2d127e5fb8ba7cfa2958a.tar.gz u-boot-imx-1a07d4585b0497f54bf2d127e5fb8ba7cfa2958a.tar.bz2 |
common: miiphyutil: avoid memory leak
The following code will alloc memory for new_dev and ldev:
"
new_dev = mdio_alloc();
ldev = malloc(sizeof(*ldev));
"
Either new_dev or ldev is NULL, directly return, but this may leak memory.
So before return, using free(ldev) and mdio_free(new_dev) to avoid
leaking memory, also free can handle NULL pointer.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
(cherry picked from commit 746da1bd42aa5ecc47898399514c9c76d0329706)
Diffstat (limited to 'configs/at91sam9263ek_dataflash_cs0_defconfig')
0 files changed, 0 insertions, 0 deletions