lkml.org 
[lkml]   [2009]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] block: fix memory leak in bio_clone()
Sorry, there was a typo in the previous patch..

=============

From: Li Zefan <lizf@cn.fujitsu.com>
Subject: [PATCH] block: fix memory leak in bio_clone()

If bio_integrity_clone() fails, bio_clone() returns NULL without freeing
the newly allocated bio.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
fs/bio.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index 124b95c..c687847 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -465,8 +465,10 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)

ret = bio_integrity_clone(b, bio, fs_bio_set);

- if (ret < 0)
+ if (ret < 0) {
+ bio_put(b);
return NULL;
+ }
}

return b;
--
1.5.4.rc3


\
 
 \ /
  Last update: 2009-03-09 10:25    [W:0.609 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site