mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
jfs: Fix memleak in dbAdjCtl
When dbBackSplit() fails, mp should be released to prevent memleak. It's the same when dbJoin() fails. Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
This commit is contained in:
parent
ed1c9a7a85
commit
751341b4d7
1 changed files with 6 additions and 2 deletions
|
@ -2549,15 +2549,19 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
|
||||||
*/
|
*/
|
||||||
if (oldval == NOFREE) {
|
if (oldval == NOFREE) {
|
||||||
rc = dbBackSplit((dmtree_t *) dcp, leafno);
|
rc = dbBackSplit((dmtree_t *) dcp, leafno);
|
||||||
if (rc)
|
if (rc) {
|
||||||
|
release_metapage(mp);
|
||||||
return rc;
|
return rc;
|
||||||
|
}
|
||||||
oldval = dcp->stree[ti];
|
oldval = dcp->stree[ti];
|
||||||
}
|
}
|
||||||
dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval);
|
dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval);
|
||||||
} else {
|
} else {
|
||||||
rc = dbJoin((dmtree_t *) dcp, leafno, newval);
|
rc = dbJoin((dmtree_t *) dcp, leafno, newval);
|
||||||
if (rc)
|
if (rc) {
|
||||||
|
release_metapage(mp);
|
||||||
return rc;
|
return rc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if the root of the current dmap control page changed due
|
/* check if the root of the current dmap control page changed due
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue