You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2024/10/28 13:10:21 UTC

(nuttx-apps) 02/02: apps/system/vi: Add missing vi_release before exit.

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit c7a905ec0cb0ccf3b3c068692115fc7e433748d3
Author: Leo Chung <ge...@gmail.com>
AuthorDate: Thu Oct 24 17:20:54 2024 +0800

    apps/system/vi: Add missing vi_release before exit.
    
    If VI exit without vi_release, that broken console.
    
    Signed-off-by: Leo Chung <ge...@gmail.com>
---
 system/vi/vi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/system/vi/vi.c b/system/vi/vi.c
index e077427f4..77aab8d79 100644
--- a/system/vi/vi.c
+++ b/system/vi/vi.c
@@ -559,6 +559,7 @@ static void vi_write(FAR struct vi_s *vi, FAR const char *buffer,
             {
               fprintf(stderr, "ERROR: write to stdout failed: %d\n",
                       errcode);
+              vi_release(vi);
               exit(EXIT_FAILURE);
             }
         }
@@ -635,6 +636,7 @@ static int vi_getch(FAR struct vi_s *vi)
                 {
                   fprintf(stderr, "ERROR: read from stdin failed: %d\n",
                           errcode);
+                  vi_release(vi);
                   exit(EXIT_FAILURE);
                 }
             }