From: Anton Moryakov <ant.v.morya...@gmail.com> Free allocated name buffer when blk_create_devicef() fails to prevent memory leak. After successful device creation, the name ownership is transferred to the device structure and should not be freed manually.
Signed-off-by: Anton Moryakov <ant.v.morya...@gmail.com>" --- drivers/scsi/scsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index cd0b84c0622..a9e364d3fdb 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -522,8 +522,10 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose) return log_msg_ret("pro", ret); ret = bootdev_setup_for_sibling_blk(bdev, "scsi_bootdev"); - if (ret) + if (ret) { + free(name); return log_msg_ret("bd", ret); + } if (verbose) { printf(" Device %d: ", bdesc->devnum); -- 2.30.2