mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 04:26:04 +08:00
nshlib: fix memory leak found out by -fanalyzer
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
@@ -391,7 +391,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
|
|||||||
ret = dd_infopen(infile, &dd);
|
ret = dd_infopen(infile, &dd);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
goto errout_with_paths;
|
goto errout_with_alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the output file */
|
/* Open the output file */
|
||||||
@@ -475,6 +475,8 @@ errout_with_outf:
|
|||||||
|
|
||||||
errout_with_inf:
|
errout_with_inf:
|
||||||
close(dd.infd);
|
close(dd.infd);
|
||||||
|
|
||||||
|
errout_with_alloc:
|
||||||
free(dd.buffer);
|
free(dd.buffer);
|
||||||
|
|
||||||
errout_with_paths:
|
errout_with_paths:
|
||||||
|
Reference in New Issue
Block a user