summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Giraud <manuel@ledu-giraud.fr>2022-09-23 17:14:44 +0200
committerEli Zaretskii <eliz@gnu.org>2022-09-24 19:07:27 +0300
commit703f29d541e099c9f43b1b2877846e12098e7361 (patch)
treefe3d633a907db066f9e0435bf652f3b1571d726d
parent4b85ae6a24380fb67a3315eaec9233f17a872473 (diff)
downloademacs-703f29d541e099c9f43b1b2877846e12098e7361.tar.gz
Ensure no memory leaks of glyph_matrix
; * src/dispnew.c (allocate_matrices_for_window_redisplay): Allocate each glyph_matrix only when it's NULL. (Bug#58028)
-rw-r--r--src/dispnew.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index b786f0f1ba4..2568ba1086a 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1810,9 +1810,12 @@ allocate_matrices_for_window_redisplay (struct window *w)
if (w->desired_matrix == NULL)
{
w->desired_matrix = new_glyph_matrix (NULL);
- w->current_matrix = new_glyph_matrix (NULL);
+ eassert (w->current_matrix == NULL);
}
+ if (w->current_matrix == NULL)
+ w->current_matrix = new_glyph_matrix (NULL);
+
dim.width = required_matrix_width (w);
dim.height = required_matrix_height (w);
adjust_glyph_matrix (w, w->desired_matrix, 0, 0, dim);