lkml.org 
[lkml]   [2003]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] memory leak in ext3+htree
From
Date

Hello!

here is very simple fix against memory leak in ext3's readdir().



diff -uNr linux/fs/ext3/dir.c edited/fs/ext3/dir.c
--- linux/fs/ext3/dir.c Mon Nov 11 06:28:16 2002
+++ edited/fs/ext3/dir.c Mon Feb 24 17:39:59 2003
@@ -33,12 +33,17 @@
static int ext3_readdir(struct file *, void *, filldir_t);
static int ext3_dx_readdir(struct file * filp,
void * dirent, filldir_t filldir);
+static int ext3_release_dir (struct inode * inode,
+ struct file * filp);

struct file_operations ext3_dir_operations = {
.read = generic_read_dir,
.readdir = ext3_readdir, /* we take BKL. needed?*/
.ioctl = ext3_ioctl, /* BKL held */
.fsync = ext3_sync_file, /* BKL held */
+#ifdef CONFIG_EXT3_INDEX
+ .release = ext3_release_dir,
+#endif
};


@@ -481,4 +491,13 @@
UPDATE_ATIME(inode);
return 0;
}
+
+static int ext3_release_dir (struct inode * inode, struct file * filp)
+{
+ if (is_dx(inode) && filp->private_data)
+ ext3_htree_free_dir_info(filp->private_data);
+
+ return 0;
+}
+
#endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.022 / U:3.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site