]> git.eshelyaron.com Git - emacs.git/commitdiff
Ensure no memory leaks of glyph_matrix
authorManuel Giraud <manuel@ledu-giraud.fr>
Fri, 23 Sep 2022 15:14:44 +0000 (17:14 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 24 Sep 2022 16:07:27 +0000 (19:07 +0300)
; * src/dispnew.c (allocate_matrices_for_window_redisplay): Allocate
each glyph_matrix only when it's NULL.  (Bug#58028)

src/dispnew.c

index b786f0f1ba420b9aff41f007534c7a0d69435ebd..2568ba1086ae81fc63f5d297ef9e4ab763bac621 100644 (file)
@@ -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);