diff options
author | Thomas Mühlbacher <tmuehlbacher@posteo.net> | 2021-01-27 20:00:04 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2021-01-29 18:41:31 +0100 |
commit | 8af95b4c4b07524e43004eaf00dbf18ec63fa594 (patch) | |
tree | 54989e31a4a00f91a75d758df86385d0811a5576 | |
parent | c5617502c50c85cd2c604b2c3a616aa95abb5cc9 (diff) | |
download | mutter-8af95b4c4b07524e43004eaf00dbf18ec63fa594.tar.gz |
monitor-config: Free `meta_monitor_spec` safely
`g_free()` alone can't help if the value it gets is `NULL` + the offset
of the struct members.
This prevents gnome-shell from segfaulting if `monitors.xml` contains
invalid XML.
Closes: <https://gitlab.gnome.org/GNOME/mutter/-/issues/1011>
(cherry picked from commit 88647ae23cd818c28ff81fd9de38aac4144c4994)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1694>
-rw-r--r-- | src/backends/meta-monitor-config-manager.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c index 1ef92c2d4..fc7a8dd54 100644 --- a/src/backends/meta-monitor-config-manager.c +++ b/src/backends/meta-monitor-config-manager.c @@ -1388,7 +1388,8 @@ meta_monitor_config_manager_class_init (MetaMonitorConfigManagerClass *klass) void meta_monitor_config_free (MetaMonitorConfig *monitor_config) { - meta_monitor_spec_free (monitor_config->monitor_spec); + if (monitor_config->monitor_spec) + meta_monitor_spec_free (monitor_config->monitor_spec); g_free (monitor_config->mode_spec); g_free (monitor_config); } |