diff --git a/fsutils/inifile/inifile.c b/fsutils/inifile/inifile.c index 1057b930314..8c12d1a94fb 100644 --- a/fsutils/inifile/inifile.c +++ b/fsutils/inifile/inifile.c @@ -527,6 +527,7 @@ INIHANDLE inifile_initialize(FAR const char *inifile_name) else { inidbg("ERROR: Could not open \"%s\"\n", inifile_name); + free(priv); return (INIHANDLE)NULL; } } diff --git a/fsutils/mksmartfs/mksmartfs.c b/fsutils/mksmartfs/mksmartfs.c index 9066d136cee..180afab9bb6 100644 --- a/fsutils/mksmartfs/mksmartfs.c +++ b/fsutils/mksmartfs/mksmartfs.c @@ -173,6 +173,7 @@ int mksmartfs(FAR const char *pathname, uint16_t sectorsize) fd = open(pathname, O_RDWR); if (fd < 0) { + ret = -ENOENT; goto errout; } diff --git a/nshlib/nsh_fscmds.c b/nshlib/nsh_fscmds.c index 89db3f08beb..c55259eab14 100644 --- a/nshlib/nsh_fscmds.c +++ b/nshlib/nsh_fscmds.c @@ -581,6 +581,14 @@ int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } } + /* Check if the destination does not match the source */ + + if (strcmp(destpath, srcpath) == 0) + { + nsh_error(vtbl, g_fmtsyntax, argv[0]); + goto errout_with_allocpath; + } + /* Now open the destination */ wrfd = open(destpath, oflags, 0666); diff --git a/system/usbmsc/usbmsc_main.c b/system/usbmsc/usbmsc_main.c index d4f01b2097f..089ba729d7b 100644 --- a/system/usbmsc/usbmsc_main.c +++ b/system/usbmsc/usbmsc_main.c @@ -435,7 +435,7 @@ static void usbmsc_disconnect(FAR void *handle) int main(int argc, FAR char *argv[]) { struct boardioc_usbdev_ctrl_s ctrl; - FAR void *handle; + FAR void *handle = NULL; int ret; /* If this program is implemented as the NSH 'msconn' command, then we @@ -495,7 +495,10 @@ int main(int argc, FAR char *argv[]) if (ret < 0) { printf("mcsonn_main: usbmsc_configure failed: %d\n", -ret); - usbmsc_disconnect(handle); + if (handle) + { + usbmsc_disconnect(handle); + } return EXIT_FAILURE; } diff --git a/system/zmodem/zm_send.c b/system/zmodem/zm_send.c index 6efbfbb8b3c..df236556c1e 100644 --- a/system/zmodem/zm_send.c +++ b/system/zmodem/zm_send.c @@ -494,7 +494,7 @@ static int zms_zrinit(FAR struct zm_state_s *pzm) else # endif { - zmdbg("ZMS_STATE %d->%d\n", pzm->state, ); + zmdbg("ZMS_STATE %d->%d\n", pzm->state, ZMS_DONE); pzm->state = ZMS_DONE; return ZM_XFRDONE; }