You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/04/11 12:50:16 UTC

[incubator-nuttx] branch master updated: graphics/nxterm: Avoid accessing freed memory

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 46a92aeebb graphics/nxterm: Avoid accessing freed memory
46a92aeebb is described below

commit 46a92aeebbe17d2a891b9f28da6d8665c192325d
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Mon Apr 11 18:46:59 2022 +0900

    graphics/nxterm: Avoid accessing freed memory
    
    Fix accessing freed priv data.
---
 graphics/nxterm/nxterm_driver.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/graphics/nxterm/nxterm_driver.c b/graphics/nxterm/nxterm_driver.c
index b7e5489b21..3df3ad87da 100644
--- a/graphics/nxterm/nxterm_driver.c
+++ b/graphics/nxterm/nxterm_driver.c
@@ -166,7 +166,9 @@ static int nxterm_close(FAR struct file *filep)
     {
       /* Yes.. Unregister the terminal device */
 
+      nxterm_sempost(priv);
       nxterm_unregister(priv);
+      return OK;
     }
   else
     {
@@ -346,7 +348,9 @@ static int nxterm_unlink(FAR struct inode *inode)
     {
       /* No.. Unregister the terminal device now */
 
+      nxterm_sempost(priv);
       nxterm_unregister(priv);
+      return OK;
     }
 
   nxterm_sempost(priv);