summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2003-10-05 12:15:39 +0000
committerJan Djärv <jan.h.d@swipnet.se>2003-10-05 12:15:39 +0000
commit96f09305d6345236220a4c705688c63210b5b890 (patch)
tree91c7b12097efb44c27c6c200739ad7bc00296140
parentc1f0671ae91a1259334de1d4785413a29e63bbff (diff)
downloademacs-96f09305d6345236220a4c705688c63210b5b890.tar.gz
emacs-96f09305d6345236220a4c705688c63210b5b890.tar.bz2
emacs-96f09305d6345236220a4c705688c63210b5b890.zip
Fix memory leaks (from YAMAMOTO Mitsuharu)
-rw-r--r--src/ChangeLog8
-rw-r--r--src/frame.c2
-rw-r--r--src/xfns.c3
-rw-r--r--src/xterm.c14
4 files changed, 24 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b38aff206e3..1dfef46a7ce 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
2003-10-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
+ * frame.c (Fdelete_frame): Free decode_mode_spec_buffer.
+
+ * xterm.c (x_delete_display): Free font names and font_encoder
+ in dpyinfo->font_table.
+
+ * xfns.c (Fx_close_connection): Only call XFreeFont here. xfree
+ of font names moved to x_delete_display.
+
* xterm.h (struct x_display_info): New member, wm_type.
(struct x_output): New members, expected_top/left and
check_expected_move.
diff --git a/src/frame.c b/src/frame.c
index 17952b5ca16..87175e0c6c9 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1279,6 +1279,8 @@ The functions are run with one arg, the frame to be deleted. */)
if (f->namebuf)
xfree (f->namebuf);
+ if (f->decode_mode_spec_buffer)
+ xfree (f->decode_mode_spec_buffer);
if (FRAME_INSERT_COST (f))
xfree (FRAME_INSERT_COST (f));
if (FRAME_DELETEN_COST (f))
diff --git a/src/xfns.c b/src/xfns.c
index 82be739b9d9..ec1500349ea 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4212,9 +4212,6 @@ If DISPLAY is nil, that stands for the selected frame's display. */)
for (i = 0; i < dpyinfo->n_fonts; i++)
if (dpyinfo->font_table[i].name)
{
- if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name)
- xfree (dpyinfo->font_table[i].full_name);
- xfree (dpyinfo->font_table[i].name);
XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font);
}
diff --git a/src/xterm.c b/src/xterm.c
index 9189d6a0d2a..c563757e63b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10649,6 +10649,8 @@ void
x_delete_display (dpyinfo)
struct x_display_info *dpyinfo;
{
+ int i;
+
delete_keyboard_wait_descriptor (dpyinfo->connection);
/* Discard this display from x_display_name_list and x_display_list.
@@ -10700,6 +10702,18 @@ x_delete_display (dpyinfo)
xim_close_dpy (dpyinfo);
#endif
+ /* Free the font names in the font table. */
+ for (i = 0; i < dpyinfo->n_fonts; i++)
+ if (dpyinfo->font_table[i].name)
+ {
+ if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name)
+ xfree (dpyinfo->font_table[i].full_name);
+ xfree (dpyinfo->font_table[i].name);
+ }
+
+ if (dpyinfo->font_table->font_encoder)
+ xfree (dpyinfo->font_table->font_encoder);
+
xfree (dpyinfo->font_table);
xfree (dpyinfo->x_id_name);
xfree (dpyinfo->color_cells);