APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1526725304 -3600
# Sat May 19 11:21:44 2018 +0100
# Node ID 65f388195140fc4a544c42a52b93e30ec9df46ca
# Parent 8a7f058930de4b49190ad1381cba59dbfc93483d
Fix some leaks in the GTK code.
src/ChangeLog addition:
2018-05-19 Aidan Kehoe <kehoea(a)parhasard.net>
Fix some leaks in the GTK code.
* event-gtk.c (gtk_reset_key_mapping):
Avoid XKeysymToString() here, there's no need for it anymore, and
it leaks.
* glyphs-gtk.c (gtk_xpm_instantiate):
XpmCreateDataFromImage() allocates its data on the heap, and
that data needs to be freed.
diff -r 8a7f058930de -r 65f388195140 src/ChangeLog
--- a/src/ChangeLog Fri Apr 27 22:05:22 2018 +0100
+++ b/src/ChangeLog Sat May 19 11:21:44 2018 +0100
@@ -1,3 +1,13 @@
+2018-05-19 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ Fix some leaks in the GTK code.
+ * event-gtk.c (gtk_reset_key_mapping):
+ Avoid XKeysymToString() here, there's no need for it anymore, and
+ it leaks.
+ * glyphs-gtk.c (gtk_xpm_instantiate):
+ XpmCreateDataFromImage() allocates its data on the heap, and
+ that data needs to be freed.
+
2018-04-25 Aidan Kehoe <kehoea(a)parhasard.net>
* data.c (Fatom, Flistp, Fnlistp, Fbitp, Fzerop, Ftrue_list_p):
diff -r 8a7f058930de -r 65f388195140 src/event-gtk.c
--- a/src/event-gtk.c Fri Apr 27 22:05:22 2018 +0100
+++ b/src/event-gtk.c Sat May 19 11:21:44 2018 +0100
@@ -1884,27 +1884,20 @@
continue;
{
- Extbyte *name = XKeysymToString (keysym[0]);
Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[0]);
- if (name)
+ if (!NILP (sym))
{
- Fputhash (build_extstring (name, Qx_keysym_encoding),
- Qsans_modifiers, hashtable);
Fputhash (sym, Qsans_modifiers, hashtable);
}
}
for (j = 1; j < keysyms_per_code; j++)
{
- if (keysym[j] != keysym[0] &&
- keysym[j] != NoSymbol)
+ if (keysym[j] != keysym[0] && keysym[j] != NoSymbol)
{
- Extbyte *name = XKeysymToString (keysym[j]);
Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[j]);
- if (name && NILP (Fgethash (sym, hashtable, Qnil)))
+ if (!NILP (sym) && NILP (Fgethash (sym, hashtable, Qnil)))
{
- Fputhash (build_extstring (name, Qx_keysym_encoding),
- Qt, hashtable);
Fputhash (sym, Qt, hashtable);
}
}
diff -r 8a7f058930de -r 65f388195140 src/glyphs-gtk.c
--- a/src/glyphs-gtk.c Fri Apr 27 22:05:22 2018 +0100
+++ b/src/glyphs-gtk.c Sat May 19 11:21:44 2018 +0100
@@ -1357,7 +1357,7 @@
{
XpmImage image;
XpmInfo info;
- char** data;
+ char **cdata;
XpmCreateXpmImageFromBuffer ((char*) dstring, &image, &info);
@@ -1387,9 +1387,16 @@
}
}
- XpmCreateDataFromXpmImage (&data, &image, &info);
-
- pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)data);
+ XpmCreateDataFromXpmImage (&cdata, &image, &info);
+ XpmFreeXpmImage (&image);
+ XpmFreeXpmInfo (&info);
+
+ pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)cdata);
+
+ if (cdata != NULL)
+ {
+ XpmFree (cdata);
+ }
}
if (color_symbols)
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)
Show replies by date