Skip to contentSkip to conversation

jffs2: leaking jffs2_summary in function jffs2_scan_medium

PATCH New Christian Engelmayer 1 participant 1 message Jun 13, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jffs2: leaking jffs2_summary in function jffs2_scan_medium

From: Christian Engelmayer <[email protected]>

In case of an error returned by file_dirty() 's' is not freed as the cleanup path is skipped.

--
Reported by Coverity.

fs/jffs2/scan.c renamed from fs/jffs2/scan.c.orig +2 -2
@@ -196,7 +196,7 @@ int jffs2_scan_medium(struct jffs2_sb_in
 				if (c->nextblock) {
 					ret = file_dirty(c, c->nextblock);
 					if (ret)
-						return ret;
+						goto out;
 					/* deleting summary information of the old nextblock */
 					jffs2_sum_reset_collected(c->summary);
 				}
@@ -207,7 +207,7 @@ int jffs2_scan_medium(struct jffs2_sb_in
 			} else {
 				ret = file_dirty(c, jeb);
 				if (ret)
-					return ret;
+					goto out;
 			}
 			break;