Commit 751341b4 authored by Dinghao Liu's avatar Dinghao Liu Committed by Dave Kleikamp
Browse files

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: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
parent ed1c9a7a
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2549,16 +2549,20 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
		 */
		if (oldval == NOFREE) {
			rc = dbBackSplit((dmtree_t *) dcp, leafno);
			if (rc)
			if (rc) {
				release_metapage(mp);
				return rc;
			}
			oldval = dcp->stree[ti];
		}
		dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval);
	} else {
		rc = dbJoin((dmtree_t *) dcp, leafno, newval);
		if (rc)
		if (rc) {
			release_metapage(mp);
			return rc;
		}
	}

	/* check if the root of the current dmap control page changed due
	 * to the update and if the current dmap control page is not at