diff --git a/src/tools/fs_shell/fs_shell_command_unix.cpp b/src/tools/fs_shell/fs_shell_command_unix.cpp index 862cecdbe4..8ba60bfc67 100644 --- a/src/tools/fs_shell/fs_shell_command_unix.cpp +++ b/src/tools/fs_shell/fs_shell_command_unix.cpp @@ -88,12 +88,14 @@ send_external_command(const char *command, int *result) if (bytesRead == 0) { fprintf(stderr, "Error: Unexpected end of fs_shell reply. Was " "still expecting %d bytes\n", toRead); + close(fd); return false; } replyBuffer += bytesRead; toRead -= bytesRead; } + close(fd); *result = reply.error; return true;