diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2008-02-25 16:54:37 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-02-25 16:54:37 -0500 |
commit | b35905c16ad6428551eb9e49525011bd2700cf56 (patch) | |
tree | 155ae1b76392b38a6079dcc5de15b123b3c20953 /fs/ext4/migrate.c | |
parent | 4cdeed861b5f797b3fa661eb331a6bd6ad669c6a (diff) |
ext4: Fix memory and buffer head leak in callers to ext4_ext_find_extent()
The path variable returned via ext4_ext_find_extent is a kmalloc
variable and needs to be freeded. It also contains a reference to
buffer_head which needs to be dropped.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/migrate.c')
-rw-r--r-- | fs/ext4/migrate.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 8c6c685b9d22..5c1e27de7755 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -43,6 +43,7 @@ static int finish_range(handle_t *handle, struct inode *inode, | |||
43 | 43 | ||
44 | if (IS_ERR(path)) { | 44 | if (IS_ERR(path)) { |
45 | retval = PTR_ERR(path); | 45 | retval = PTR_ERR(path); |
46 | path = NULL; | ||
46 | goto err_out; | 47 | goto err_out; |
47 | } | 48 | } |
48 | 49 | ||
@@ -74,6 +75,10 @@ static int finish_range(handle_t *handle, struct inode *inode, | |||
74 | } | 75 | } |
75 | retval = ext4_ext_insert_extent(handle, inode, path, &newext); | 76 | retval = ext4_ext_insert_extent(handle, inode, path, &newext); |
76 | err_out: | 77 | err_out: |
78 | if (path) { | ||
79 | ext4_ext_drop_refs(path); | ||
80 | kfree(path); | ||
81 | } | ||
77 | lb->first_pblock = 0; | 82 | lb->first_pblock = 0; |
78 | return retval; | 83 | return retval; |
79 | } | 84 | } |