This is an automated email from the ASF dual-hosted git repository.
btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 28973a37b nshlib: fix memory leak found out by -fanalyzer
28973a37b is described below
commit 28973a37b356d1a688fd603b2cfcfb07ce409c57
Author: chao an <[email protected]>
AuthorDate: Tue May 16 17:39:35 2023 +0800
nshlib: fix memory leak found out by -fanalyzer
Signed-off-by: chao an <[email protected]>
---
nshlib/nsh_ddcmd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/nshlib/nsh_ddcmd.c b/nshlib/nsh_ddcmd.c
index dea661408..1d25b2ad7 100644
--- a/nshlib/nsh_ddcmd.c
+++ b/nshlib/nsh_ddcmd.c
@@ -391,7 +391,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char
**argv)
ret = dd_infopen(infile, &dd);
if (ret < 0)
{
- goto errout_with_paths;
+ goto errout_with_alloc;
}
/* Open the output file */
@@ -475,6 +475,8 @@ errout_with_outf:
errout_with_inf:
close(dd.infd);
+
+errout_with_alloc:
free(dd.buffer);
errout_with_paths: