UBI: fix memory leak
ubi_free_volume() function sets ubi->volumes[] to NULL, so ubi_eba_close() is useless, it does not free what has to be freed. So zap it and free vol->eba_tbl at the volume release function. Pointed-out-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
@@ -1233,20 +1233,3 @@ out_free:
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* ubi_eba_close - close EBA unit.
|
||||
* @ubi: UBI device description object
|
||||
*/
|
||||
void ubi_eba_close(const struct ubi_device *ubi)
|
||||
{
|
||||
int i, num_volumes = ubi->vtbl_slots + UBI_INT_VOL_COUNT;
|
||||
|
||||
dbg_eba("close EBA unit");
|
||||
|
||||
for (i = 0; i < num_volumes; i++) {
|
||||
if (!ubi->volumes[i])
|
||||
continue;
|
||||
kfree(ubi->volumes[i]->eba_tbl);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user