apps/nshlib: Fix error handling in 'mv' command. On a failure to expand the second path, the memory allocated for the expansion of the first path was not being freed. From Bruno Herrera.
This commit is contained in:
parent
321924c0a5
commit
4555282571
@ -1418,5 +1418,8 @@
|
||||
* apps/nettest: Extend test so that can be performed using the local
|
||||
loopback device (2015-08-26).
|
||||
* apps/nshlib: Fix error handling in 'cat' command. On a failure to
|
||||
allocate memory, a file ws not being closed. From Bruno Herrera
|
||||
allocate memory, a file was not being closed. From Bruno Herrera
|
||||
(2015-08-26).
|
||||
* apps/nshlib: Fix error handling in 'mv' command. On a failure to
|
||||
expand the second path, the memory allocated for the expansion of the
|
||||
first path was not being freed. From Bruno Herrera (2015-08-26).
|
||||
|
@ -1348,8 +1348,8 @@ int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
newpath = nsh_getfullpath(vtbl, argv[2]);
|
||||
if (!newpath)
|
||||
{
|
||||
nsh_freefullpath(newpath);
|
||||
return ERROR;
|
||||
ret = ERROR;
|
||||
goto errout_with_free;
|
||||
}
|
||||
|
||||
/* Perform the mount */
|
||||
@ -1361,7 +1361,7 @@ int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Free the file paths */
|
||||
|
||||
errout_with_free:
|
||||
nsh_freefullpath(oldpath);
|
||||
nsh_freefullpath(newpath);
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user