mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-25 23:06:15 +00:00
pci: avoid memory leak
strdup uses malloc to allocate memory for str. If we cannot bind to the generic driver we should release the memory. The problem was indicated by clang scan-build. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
902f5bcfbc
commit
c42640c748
1 changed files with 1 additions and 0 deletions
|
@ -660,6 +660,7 @@ static int pci_find_and_bind_driver(struct udevice *parent,
|
|||
ret = device_bind_driver(parent, drv, str, devp);
|
||||
if (ret) {
|
||||
debug("%s: Failed to bind generic driver: %d\n", __func__, ret);
|
||||
free(str);
|
||||
return ret;
|
||||
}
|
||||
debug("%s: No match found: bound generic driver instead\n", __func__);
|
||||
|
|
Loading…
Add table
Reference in a new issue