[PATCH] UBIFS: add missing znode freeing in tcn_insert()

Florian Fainelli f.fainelli at gmail.com
Fri Mar 7 19:11:27 EST 2014


In case the zi allocation fails in the do_split label, we will fail
freeing zn that we allocated before, add a missing kfree.

Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 fs/ubifs/tnc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 9083bc7ed4ae..9b84d91ea530 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -2105,8 +2105,10 @@ do_split:
 	dbg_tnc("creating new zroot at level %d", znode->level + 1);
 
 	zi = kzalloc(c->max_znode_sz, GFP_NOFS);
-	if (!zi)
+	if (!zi) {
+		kfree(zn);
 		return -ENOMEM;
+	}
 
 	zi->child_cnt = 2;
 	zi->level = znode->level + 1;
-- 
1.8.3.2




More information about the linux-mtd mailing list