1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-11 14:01:43 -08:00

Fix segmentation fault with gdk_monitor_get_model (Bug#35259)

* src/frame.c (free_monitors): Check if NULL before freeing.

* src/xfns.c: (x-display-monitor-attributes-list): Check if NULL
before copying.
This commit is contained in:
Alexander Gramiak 2019-04-13 16:05:21 -06:00
parent 894e142082
commit 7308c2edfb
2 changed files with 4 additions and 2 deletions

View file

@ -5670,7 +5670,8 @@ free_monitors (struct MonitorInfo *monitors, int n_monitors)
{
int i;
for (i = 0; i < n_monitors; ++i)
xfree (monitors[i].name);
if (monitors[i].name)
xfree (monitors[i].name);
xfree (monitors);
}
# endif

View file

@ -5030,7 +5030,8 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
mi->mm_height = height_mm;
#if GTK_CHECK_VERSION (3, 22, 0)
mi->name = xstrdup (gdk_monitor_get_model (monitor));
if (gdk_monitor_get_model (monitor))
mi->name = xstrdup (gdk_monitor_get_model (monitor));
#elif GTK_CHECK_VERSION (2, 14, 0)
mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
#endif