Ticket #4269: (edit_close_cmd): fix use-after-free.

The old 'w' pointer became invalid after widget_destroy() call, so we need
to get the new widget directly after find_editor.

Found using PVS-Studio 7.14 with intermodular analysis mode.

Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Sergey Larin 2021-08-02 12:58:01 +03:00 committed by Andrew Borodin
parent eab84392ef
commit 2234fd8357
2 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ Version 4.8.27
- Misc
* Code clean up (#4179, #4173)
* Code clean up (#4179, #4173, #4269)
* Filehighlight of c++ and h++ files as sources (#4194)
* Filehighlight of JSON files as documents (#4250)
* Support of alacritty terminal emulator (https://github.com/alacritty/alacritty) (#4248)

View File

@ -1244,7 +1244,7 @@ edit_close_cmd (WEdit * edit)
{
edit = find_editor (DIALOG (g));
if (edit != NULL)
widget_select (w);
widget_select (WIDGET (edit));
}
}