Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce4d8b16 authored by Wenwen Wang's avatar Wenwen Wang Committed by Richard Weinberger
Browse files

ubifs: Fix memory leak in read_znode() error path



In read_znode(), the indexing node 'idx' is allocated by kmalloc().
However, it is not deallocated in the following execution if
ubifs_node_check_hash() fails, leading to a memory leak bug. To fix this
issue, free 'idx' before returning the error.

Fixes: 16a26b20 ("ubifs: authentication: Add hashes to index nodes")
Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 8615b94f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -284,6 +284,7 @@ static int read_znode(struct ubifs_info *c, struct ubifs_zbranch *zzbr,
	err = ubifs_node_check_hash(c, idx, zzbr->hash);
	if (err) {
		ubifs_bad_hash(c, idx, zzbr->hash, lnum, offs);
		kfree(idx);
		return err;
	}