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> Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1685>
This commit is contained in:
parent
70cdd72040
commit
88647ae23c
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user