diff options
Diffstat (limited to 'apps/nshlib')
-rw-r--r-- | apps/nshlib/nsh_parse.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index 26b41e89b..4ee86b4cc 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -1426,8 +1426,10 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) /* Free the redirected output file path */ - nsh_freefullpath(redirfile); - redirfile = NULL; + if (redirfile) + { + nsh_freefullpath(redirfile); + } /* Save the result: success if 0; failure if 1 */ @@ -1467,8 +1469,10 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) /* Free the redirected output file path */ - nsh_freefullpath(redirfile); - redirfile = NULL; + if (redirfile) + { + nsh_freefullpath(redirfile); + } /* Save the result: success if 0; failure if 1 */ @@ -1596,6 +1600,12 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) goto errout; } + /* Detach from the pthread since we are not going to join with it. + * Otherwise, we would have a memory leak. + */ + + (void)pthread_detach(thread); + nsh_output(vtbl, "%s [%d:%d]\n", cmd, thread, param.sched_priority); } else |