On Thu, Nov 26, 2015 at 10:26:59AM +0800, Peng Fan wrote:

> 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....@freescale.com>
> Cc: Joe Hershberger <joe.hershber...@ni.com>
> Cc: Simon Glass <s...@chromium.org>
> Cc: Bin Meng <bmeng...@gmail.com>
> Reviewed-by: Bin Meng <bmeng...@gmail.com>
> Acked-by: Joe Hershberger <joe.hershber...@ni.com>

Applied to u-boot/master, thanks!

-- 
Tom

Attachment: signature.asc
Description: Digital signature

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to