summaryrefslogtreecommitdiff
path: root/nuttx/fs/nxffs
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-03-06 08:01:56 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-03-06 08:01:56 -0600
commitdb4527cdbcc844d9ab2f9733d7e72b138d5fa611 (patch)
tree8f350ac8253c834d67eeb8d4a2e87501c844f1c1 /nuttx/fs/nxffs
parentfded810a18711e96d3ae8d56310eae4fc434550b (diff)
downloadnuttx-db4527cdbcc844d9ab2f9733d7e72b138d5fa611.tar.gz
nuttx-db4527cdbcc844d9ab2f9733d7e72b138d5fa611.tar.bz2
nuttx-db4527cdbcc844d9ab2f9733d7e72b138d5fa611.zip
NXFFS: Missing call to nxffs_freeentry() caused a memory leak
Diffstat (limited to 'nuttx/fs/nxffs')
-rw-r--r--nuttx/fs/nxffs/nxffs_open.c6
-rw-r--r--nuttx/fs/nxffs/nxffs_stat.c4
2 files changed, 9 insertions, 1 deletions
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
{