patch 8.2.4668: buffer allocation failures insufficiently tested
Problem: Buffer allocation failures insufficiently tested.
Solution: Add tests for memory allocation failures. (Yegappan Lakshmanan,
closes #10064)
diff --git a/src/window.c b/src/window.c
index 66dd099..78ce4d2 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5256,10 +5256,13 @@
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);