summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-04-02 21:46:19 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-02 21:46:19 +0100
commit0dac1ab5791819ee9a496273eea38f69a217ac45 (patch)
treea2bb44a0706e1a71b70115646ea6864e142468fa /src/window.c
parent5018a836c030988944a9bbe2fd2e538bf5261a72 (diff)
downloadvim-git-0dac1ab5791819ee9a496273eea38f69a217ac45.tar.gz
patch 8.2.4668: buffer allocation failures insufficiently testedv8.2.4668
Problem: Buffer allocation failures insufficiently tested. Solution: Add tests for memory allocation failures. (Yegappan Lakshmanan, closes #10064)
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/window.c b/src/window.c
index 66dd099bf..78ce4d235 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5256,10 +5256,13 @@ win_unlisted(win_T *wp)
void
win_free_popup(win_T *win)
{
- if (bt_popup(win->w_buffer))
- win_close_buffer(win, DOBUF_WIPE_REUSE, FALSE);
- else
- close_buffer(win, win->w_buffer, 0, FALSE, FALSE);
+ if (win->w_buffer != NULL)
+ {
+ if (bt_popup(win->w_buffer))
+ win_close_buffer(win, DOBUF_WIPE_REUSE, FALSE);
+ else
+ close_buffer(win, win->w_buffer, 0, FALSE, FALSE);
+ }
# if defined(FEAT_TIMERS)
if (win->w_popup_timer != NULL)
stop_timer(win->w_popup_timer);