memory: prevent a use-after-free when the user respects a lock file
This fixes https://savannah.gnu.org/bugs/?60447.
Bug existed since commit 2f718e11
from a month ago.
master
parent
af90f03ac5
commit
6283557d2f
|
@ -603,14 +603,14 @@ void close_buffer(void)
|
|||
free(orphan->errormessage);
|
||||
|
||||
openfile = orphan->prev;
|
||||
if (openfile == orphan)
|
||||
openfile = NULL;
|
||||
|
||||
free(orphan);
|
||||
|
||||
/* When just one buffer remains open, show "Exit" in the help lines. */
|
||||
if (openfile == openfile->next)
|
||||
if (openfile && openfile == openfile->next)
|
||||
exitfunc->desc = exit_tag;
|
||||
|
||||
if (openfile == orphan)
|
||||
openfile = NULL;
|
||||
}
|
||||
#endif /* ENABLE_MULTIBUFFER */
|
||||
|
||||
|
|
Loading…
Reference in New Issue