diff options
| author | Alexander Gramiak | 2019-04-06 23:02:24 -0600 |
|---|---|---|
| committer | Alexander Gramiak | 2019-04-07 12:49:02 -0600 |
| commit | a35e06bbe27c5907f56c5aeb48182d7be00d1dec (patch) | |
| tree | 49206a9771c4b727e8f75449aff8c2f0077f6d4d /src | |
| parent | 404a5470cf1b1ae5bd464aaf8fe909b86faa2e61 (diff) | |
| download | emacs-a35e06bbe27c5907f56c5aeb48182d7be00d1dec.tar.gz emacs-a35e06bbe27c5907f56c5aeb48182d7be00d1dec.zip | |
Plug memory leak in GTK x-display-monitor-attributes-list
* src/frame.c (free_monitors) [USE_GTK]: Define in the GTK case as
well.
* src/xfns.c (x-display-monitor-attributes-list) [USE_GTK]: Plug
memory leak.
* src/frame.h (MonitorInfo): Declare name as pointing to const char.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.c | 4 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/xfns.c | 7 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/frame.c b/src/frame.c index d0c77149ba8..6fdb7d0cbb9 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -5662,8 +5662,8 @@ selected frame. This is useful when `make-pointer-invisible' is set. */) | |||
| 5662 | 5662 | ||
| 5663 | #ifdef HAVE_WINDOW_SYSTEM | 5663 | #ifdef HAVE_WINDOW_SYSTEM |
| 5664 | 5664 | ||
| 5665 | # if (defined HAVE_NS \ | 5665 | # if (defined USE_GTK || defined HAVE_NS || defined HAVE_XINERAMA \ |
| 5666 | || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR))) | 5666 | || defined HAVE_XRANDR) |
| 5667 | void | 5667 | void |
| 5668 | free_monitors (struct MonitorInfo *monitors, int n_monitors) | 5668 | free_monitors (struct MonitorInfo *monitors, int n_monitors) |
| 5669 | { | 5669 | { |
diff --git a/src/frame.h b/src/frame.h index ed62e7ace0f..b1eedf36a38 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1648,7 +1648,7 @@ flush_frame (struct frame *f) | |||
| 1648 | struct MonitorInfo { | 1648 | struct MonitorInfo { |
| 1649 | XRectangle geom, work; | 1649 | XRectangle geom, work; |
| 1650 | int mm_width, mm_height; | 1650 | int mm_width, mm_height; |
| 1651 | char *name; | 1651 | const char *name; |
| 1652 | }; | 1652 | }; |
| 1653 | 1653 | ||
| 1654 | extern void free_monitors (struct MonitorInfo *monitors, int n_monitors); | 1654 | extern void free_monitors (struct MonitorInfo *monitors, int n_monitors); |
diff --git a/src/xfns.c b/src/xfns.c index f238a3daa15..9a25b00b20e 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5030,7 +5030,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 5030 | mi->mm_height = height_mm; | 5030 | mi->mm_height = height_mm; |
| 5031 | 5031 | ||
| 5032 | #if GTK_CHECK_VERSION (3, 22, 0) | 5032 | #if GTK_CHECK_VERSION (3, 22, 0) |
| 5033 | mi->name = g_strdup (gdk_monitor_get_model (monitor)); | 5033 | mi->name = xstrdup (gdk_monitor_get_model (monitor)); |
| 5034 | #elif GTK_CHECK_VERSION (2, 14, 0) | 5034 | #elif GTK_CHECK_VERSION (2, 14, 0) |
| 5035 | mi->name = gdk_screen_get_monitor_plug_name (gscreen, i); | 5035 | mi->name = gdk_screen_get_monitor_plug_name (gscreen, i); |
| 5036 | #endif | 5036 | #endif |
| @@ -5041,6 +5041,11 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 5041 | primary_monitor, | 5041 | primary_monitor, |
| 5042 | monitor_frames, | 5042 | monitor_frames, |
| 5043 | source); | 5043 | source); |
| 5044 | #if GTK_CHECK_VERSION (2, 14, 0) | ||
| 5045 | free_monitors (monitors, n_monitors); | ||
| 5046 | #else | ||
| 5047 | xfree (monitors) | ||
| 5048 | #endif | ||
| 5044 | unblock_input (); | 5049 | unblock_input (); |
| 5045 | #else /* not USE_GTK */ | 5050 | #else /* not USE_GTK */ |
| 5046 | 5051 | ||