summaryrefslogtreecommitdiff
path: root/apps/nshlib/nsh_parse.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-02 23:56:54 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-02 23:56:54 +0000
commitbed10d9288e1c61599580049d63fe74873c08b37 (patch)
treec2045a94c067d8c6d0bf486449349494b9f1c1ff /apps/nshlib/nsh_parse.c
parent2cc0db0c264e064ee203c2f19b91f7ba013fdf25 (diff)
downloadnuttx-bed10d9288e1c61599580049d63fe74873c08b37.tar.gz
nuttx-bed10d9288e1c61599580049d63fe74873c08b37.tar.bz2
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 'apps/nshlib/nsh_parse.c')
-rw-r--r--apps/nshlib/nsh_parse.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c
index f679d9b32..26b41e89b 100644
--- a/apps/nshlib/nsh_parse.c
+++ b/apps/nshlib/nsh_parse.c
@@ -1424,6 +1424,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
* successfully). So certainly it is not an NSH command.
*/
+ /* Free the redirected output file path */
+
+ nsh_freefullpath(redirfile);
+ redirfile = NULL;
+
+ /* Save the result: success if 0; failure if 1 */
+
return nsh_saveresult(vtbl, ret != OK);
}
@@ -1458,6 +1465,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
* successfully). So certainly it is not an NSH command.
*/
+ /* Free the redirected output file path */
+
+ nsh_freefullpath(redirfile);
+ redirfile = NULL;
+
+ /* Save the result: success if 0; failure if 1 */
+
return nsh_saveresult(vtbl, ret != OK);
}