graphics/nxterm: Avoid accessing freed memory

Fix accessing freed priv data.
This commit is contained in:
SPRESENSE 2022-04-11 18:46:59 +09:00 committed by Xiang Xiao
parent 8dd5d0d510
commit 46a92aeebb

View File

@ -166,7 +166,9 @@ static int nxterm_close(FAR struct file *filep)
{ {
/* Yes.. Unregister the terminal device */ /* Yes.. Unregister the terminal device */
nxterm_sempost(priv);
nxterm_unregister(priv); nxterm_unregister(priv);
return OK;
} }
else else
{ {
@ -346,7 +348,9 @@ static int nxterm_unlink(FAR struct inode *inode)
{ {
/* No.. Unregister the terminal device now */ /* No.. Unregister the terminal device now */
nxterm_sempost(priv);
nxterm_unregister(priv); nxterm_unregister(priv);
return OK;
} }
nxterm_sempost(priv); nxterm_sempost(priv);