diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-03-06 08:01:56 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-03-06 08:01:56 -0600 |
commit | db4527cdbcc844d9ab2f9733d7e72b138d5fa611 (patch) | |
tree | 8f350ac8253c834d67eeb8d4a2e87501c844f1c1 | |
parent | fded810a18711e96d3ae8d56310eae4fc434550b (diff) | |
download | nuttx-db4527cdbcc844d9ab2f9733d7e72b138d5fa611.tar.gz nuttx-db4527cdbcc844d9ab2f9733d7e72b138d5fa611.tar.bz2 nuttx-db4527cdbcc844d9ab2f9733d7e72b138d5fa611.zip |
NXFFS: Missing call to nxffs_freeentry() caused a memory leak
-rw-r--r-- | nuttx/ChangeLog | 4 | ||||
-rw-r--r-- | nuttx/fs/nxffs/nxffs_open.c | 6 | ||||
-rw-r--r-- | nuttx/fs/nxffs/nxffs_stat.c | 4 |
3 files changed, 13 insertions, 1 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 03f09ac1a..e0f34bdcb 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -6896,3 +6896,7 @@ * Many files: Use common naming for rest of the toolchains (2014-3-5). * configs/ne64badge/ostest and demo9s12nec64/ostest: Configurations converted to use the kconfig-frontends tools (2014-3-5) + * fs/nxffs/nxffs_open.c: Missing call to nxffs_freeentry() causes + memory leak. From Lzyy (2014-3-6). + * fs/nxffs/nxffs_stat.c: Looks like stat() has the same problem as + the one reported by Lzyy (2014-3-6). diff --git a/nuttx/fs/nxffs/nxffs_open.c b/nuttx/fs/nxffs/nxffs_open.c index ff7d5372f..2970afbed 100644 --- a/nuttx/fs/nxffs/nxffs_open.c +++ b/nuttx/fs/nxffs/nxffs_open.c @@ -428,7 +428,11 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume, { FAR struct nxffs_ofile_s *ofile; - /* It exists. Is the file already open for reading? */ + /* It exists. Release the entry. */ + + nxffs_freeentry(&entry); + + /* Is the file already open for reading? */ ofile = nxffs_findofile(volume, name); if (ofile) diff --git a/nuttx/fs/nxffs/nxffs_stat.c b/nuttx/fs/nxffs/nxffs_stat.c index ab8c51cc2..656da395a 100644 --- a/nuttx/fs/nxffs/nxffs_stat.c +++ b/nuttx/fs/nxffs/nxffs_stat.c @@ -171,6 +171,10 @@ int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath, buf->st_atime = entry.utc; buf->st_mtime = entry.utc; buf->st_ctime = entry.utc; + + /* Free inode resources */ + + nxffs_freeentry(&entry); } else { |