diff --git a/nshlib/nsh_dbgcmds.c b/nshlib/nsh_dbgcmds.c index c86d77109..cc67a2708 100644 --- a/nshlib/nsh_dbgcmds.c +++ b/nshlib/nsh_dbgcmds.c @@ -395,6 +395,7 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) buffer = (FAR uint8_t *)malloc(IOBUFFERSIZE); if(buffer == NULL) { + (void)close(fd); nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "malloc", NSH_ERRNO); return ERROR; }