diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-02 23:56:54 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-02 23:56:54 +0000 |
commit | bed10d9288e1c61599580049d63fe74873c08b37 (patch) | |
tree | c2045a94c067d8c6d0bf486449349494b9f1c1ff /nuttx/fs | |
parent | 2cc0db0c264e064ee203c2f19b91f7ba013fdf25 (diff) | |
download | px4-nuttx-bed10d9288e1c61599580049d63fe74873c08b37.tar.gz px4-nuttx-bed10d9288e1c61599580049d63fe74873c08b37.tar.bz2 px4-nuttx-bed10d9288e1c61599580049d63fe74873c08b37.zip |
Correct a memory leak in NSH
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5600 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs')
-rw-r--r-- | nuttx/fs/fat/fs_fat32.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c index df8962b51..7202bb63d 100644 --- a/nuttx/fs/fat/fs_fat32.c +++ b/nuttx/fs/fat/fs_fat32.c @@ -637,9 +637,21 @@ static ssize_t fat_write(FAR struct file *filep, const char *buffer, int sectorindex; int ret; - /* Sanity checks */ + /* Sanity checks. I have seen the following assertion misfire if + * CONFIG_DEBUG_MM is enabled while re-directing output to a + * file. In this case, the debug output can get generated while + * the file is being opened, FAT data structures are being allocated, + * and things are generally in a perverse state. + */ +#ifdef CONFIG_DEBUG_MM + if (filep->f_priv == NULL || filep->f_inode == NULL) + { + return -ENXIO; + } +#else DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL); +#endif /* Recover our private data from the struct file instance */ |