This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Memory leak in JFFS2 unmount
- From: Øyvind Harboe <oyvind dot harboe at zylin dot com>
- To: ecos-patches at sources dot redhat dot com
- Cc: thomas dot koeller at baslerweb dot com
- Date: Thu, 11 Mar 2004 13:41:07 +0100
- Subject: Memory leak in JFFS2 unmount
- Organization: Zylin AS
The attached patch fixes a memory leak in JFFS2 unmount.
Øyvind
Index: ecos/packages/fs/jffs2/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/ChangeLog,v
retrieving revision 1.26
diff -a -w -u -r1.26 ChangeLog
--- ecos/packages/fs/jffs2/current/ChangeLog 9 Mar 2004 08:12:08 -0000 1.26
+++ ecos/packages/fs/jffs2/current/ChangeLog 11 Mar 2004 12:36:24 -0000
@@ -1,3 +1,8 @@
+2004-03-11 Oyvind Harboe <oyvind.harboe@zylin.com>
+
+ * src/fs-ecos.c:
+ Fixed umount memory leak. root->jffs2_i.dents where not freed.
+
2004-02-20 Vincent Catros <Vincent.Catros@elios-informatique.fr>
* src/fs-ecos.c :
Index: ecos/packages/fs/jffs2/current/src/fs-ecos.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/fs-ecos.c,v
retrieving revision 1.19
diff -a -w -u -r1.19 fs-ecos.c
--- ecos/packages/fs/jffs2/current/src/fs-ecos.c 9 Mar 2004 08:12:08 -0000 1.19
+++ ecos/packages/fs/jffs2/current/src/fs-ecos.c 11 Mar 2004 12:36:24 -0000
@@ -592,6 +592,7 @@
struct _inode *root = (struct _inode *) mte->root;
struct super_block *jffs2_sb = root->i_sb;
struct jffs2_sb_info *c = JFFS2_SB_INFO(jffs2_sb);
+ struct jffs2_full_dirent *fd, *next;
D2(printf("jffs2_umount\n"));
@@ -635,6 +636,13 @@
jffs2_stop_garbage_collect_thread(c);
#endif
jffs2_iput(root); // Time to free the root inode
+
+ // free directory entries
+ for (fd = root->jffs2_i.dents; fd; fd = next) {
+ next=fd->next;
+ free(fd);
+ }
+
free(root);
//Clear root inode
//root_i = NULL;