Skip to contentSkip to conversation

Memory leak on revoke error

PATCH New Bob Peterson 1 participant 1 message Jan 21, 2008 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Memory leak on revoke error

Hi,

I ran across this rare memory leak in revoke_lo_scan_elements while working on bz 349271. This patch is for upstream gfs2.

Regards,

Bob Peterson
--

--

 fs/gfs2/lops.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/gfs2/lops.c +3 -1
index 29a8689..6dfcf4c 100644
@@ -421,8 +421,10 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
 			blkno = be64_to_cpu(*(__be64 *)(bh->b_data + offset));
 
 			error = gfs2_revoke_add(sdp, blkno, start);
-			if (error < 0)
+			if (error < 0) {
+				brelse(bh);
 				return error;
+			}
 			else if (error)
 				sdp->sd_found_revokes++;