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 <[email protected]>
> Cc: Joe Hershberger <[email protected]>
> Cc: Simon Glass <[email protected]>
> Cc: Bin Meng <[email protected]>
> Reviewed-by: Bin Meng <[email protected]>
> Acked-by: Joe Hershberger <[email protected]>

Applied to u-boot/master, thanks!

-- 
Tom

Attachment: signature.asc
Description: Digital signature

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to