Skip to content

Commit

Permalink
apps/nshlib: Reuse local variable for cmd_memdump
Browse files Browse the repository at this point in the history
Signed-off-by: wangjianyu3 <[email protected]>
  • Loading branch information
JianyuWang0623 committed Jan 16, 2025
1 parent 339eeaa commit f002ded
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions nshlib/nsh_mmcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
int cmd_memdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
{
FAR char *arg;
int ret;
int i;

arg = lib_get_tempbuffer(LINE_MAX);
Expand All @@ -78,10 +77,10 @@ int cmd_memdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
else if (argc >= 2 && (strcmp(argv[1], "-h") == 0 ||
strcmp(argv[1], "help") == 0))
{
ret = nsh_catfile(vtbl, argv[0],
CONFIG_NSH_PROC_MOUNTPOINT "/memdump");
i = nsh_catfile(vtbl, argv[0],
CONFIG_NSH_PROC_MOUNTPOINT "/memdump");
lib_put_tempbuffer(arg);
return ret;
return i;
}
else
{
Expand All @@ -95,10 +94,10 @@ int cmd_memdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
}

ret = nsh_writefile(vtbl, argv[0], arg, strlen(arg),
CONFIG_NSH_PROC_MOUNTPOINT "/memdump");
i = nsh_writefile(vtbl, argv[0], arg, strlen(arg),
CONFIG_NSH_PROC_MOUNTPOINT "/memdump");
lib_put_tempbuffer(arg);
return ret;
return i;
}

#endif /* !CONFIG_NSH_DISABLE_MEMDUMP && NSH_HAVE_WRITEFILE */

0 comments on commit f002ded

Please sign in to comment.