mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-03-03 16:04:47 +01:00
ipq6018: free ubi ptr to avoid memory leak
This patch will free the ubi volume and ubi object memory Change-Id: I4151fc70efefbf338123a734f2abcbc48e440444 Signed-off-by: Rajkumar Ayyasamy <arajkuma@codeaurora.org>
This commit is contained in:
parent
fd7d21dd13
commit
ffeea6dd1e
1 changed files with 16 additions and 0 deletions
|
|
@ -984,6 +984,7 @@ int ubi_set_rootfs_part(void)
|
|||
uint32_t size_block, start_block;
|
||||
qca_smem_flash_info_t *sfi = &qca_smem_flash_info;
|
||||
char runcmd[256];
|
||||
int i;
|
||||
|
||||
if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) {
|
||||
ret = smem_getpart(QCA_ROOT_FS_PART_NAME,
|
||||
|
|
@ -1004,6 +1005,16 @@ int ubi_set_rootfs_part(void)
|
|||
if (!part_size)
|
||||
return -ENOENT;
|
||||
|
||||
if (ubi) {
|
||||
for (i = 0; i < ubi->vtbl_slots; i++) {
|
||||
if (ubi->volumes[i]) {
|
||||
kfree(ubi->volumes[i]->eba_tbl);
|
||||
kfree(ubi->volumes[i]);
|
||||
ubi->volumes[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(runcmd, sizeof(runcmd),
|
||||
"nand device %d && "
|
||||
"setenv mtdids nand%d=nand%d && "
|
||||
|
|
@ -1017,6 +1028,11 @@ int ubi_set_rootfs_part(void)
|
|||
if (run_command(runcmd, 0) != CMD_RET_SUCCESS)
|
||||
return CMD_RET_FAILURE;
|
||||
|
||||
if (ubi) {
|
||||
kfree(ubi);
|
||||
ubi = NULL;
|
||||
}
|
||||
|
||||
ubi = ubi_devices[0];
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue