mtd/fs/jffs2 build.c,1.81,1.82

Artem Bityutskiy dedekind at infradead.org
Wed Sep 21 10:48:24 EDT 2005


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv8612

Modified Files:
	build.c 
Log Message:
[JFFS2] bugfix: free everything on error.


Index: build.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/build.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- build.c	21 Sep 2005 13:26:23 -0000	1.81
+++ build.c	21 Sep 2005 14:48:22 -0000	1.82
@@ -349,23 +349,28 @@
 
 	ret = jffs2_sum_init(c);
 	if (ret)
-		return ret;
+		goto error;
 
-	if (jffs2_build_filesystem(c)) {
-		dbg_fsbuild("build_fs failed\n");
+	ret = jffs2_build_filesystem(c);
+	if (ret) {
+		dbg_fsbuild("failed to build FS\n");
 		jffs2_free_ino_caches(c);
 		jffs2_free_raw_node_refs(c);
-#ifndef __ECOS
-		if (jffs2_blocks_use_vmalloc(c))
-			vfree(c->blocks);
-		else 
-#endif
-			kfree(c->blocks);
-
-		return -EIO;
+		goto error;
 	}
 
 	jffs2_calc_trigger_levels(c);
 
 	return 0;
+
+error:
+	
+#ifndef __ECOS
+	if (jffs2_blocks_use_vmalloc(c))
+		vfree(c->blocks);
+	else 
+#endif
+		kfree(c->blocks);
+
+	return ret;
 }





More information about the linux-mtd-cvs mailing list