From 28c58bf739fb5cc528051cfc48770fbfa4e1a319 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 20 Oct 2015 18:12:55 +0300 Subject: [PATCH] Fix memory leak in fontset handling * src/font.c (copy_font_spec): Make a deep copy of the input argument FONT. (Bug#21651) --- src/font.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/font.c b/src/font.c index a52a653d29b..be55ce9bc7b 100644 --- a/src/font.c +++ b/src/font.c @@ -3981,7 +3981,10 @@ copy_font_spec (Lisp_Object font) pcdr = spec->props + FONT_EXTRA_INDEX; for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) if (!EQ (XCAR (XCAR (tail)), QCfont_entity)) - *pcdr = Fcons (XCAR (tail), Qnil), pcdr = xcdr_addr (*pcdr); + { + *pcdr = Fcons (Fcons (XCAR (XCAR (tail)), CDR (XCAR (tail))), Qnil); + pcdr = xcdr_addr (*pcdr); + } XSETFONT (new_spec, spec); return new_spec; -- 2.39.2