Blame SOURCES/0024-monitor-config-migration-Free-the-output-key-on-inva.patch

79df40
From c07364d65d3e6353076b02c97ce63dfe00aaedc7 Mon Sep 17 00:00:00 2001
79df40
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
79df40
Date: Thu, 25 Jul 2019 01:21:28 +0200
79df40
Subject: [PATCH 24/28] monitor-config-migration: Free the output key on
79df40
 invalid spec
79df40
79df40
In create_monitor_config we assume that we take the ownership of the output_key
79df40
values, however if we have an early return because an invalid spec is set, we
79df40
don't free it.
79df40
79df40
So cleanup it on failure, as it happens for other cases.
79df40
79df40
https://gitlab.gnome.org/GNOME/mutter/merge_requests/682
79df40
---
79df40
 src/backends/meta-monitor-config-migration.c | 1 +
79df40
 1 file changed, 1 insertion(+)
79df40
79df40
diff --git a/src/backends/meta-monitor-config-migration.c b/src/backends/meta-monitor-config-migration.c
79df40
index ed6c80184..26393ef02 100644
79df40
--- a/src/backends/meta-monitor-config-migration.c
79df40
+++ b/src/backends/meta-monitor-config-migration.c
79df40
@@ -655,60 +655,61 @@ load_config_file (GFile   *file,
79df40
       g_free (parser.output_field);
79df40
       g_hash_table_destroy (parser.configs);
79df40
 
79df40
       return NULL;
79df40
     }
79df40
 
79df40
   return parser.configs;
79df40
 }
79df40
 
79df40
 static MetaMonitorConfig *
79df40
 create_monitor_config (MetaOutputKey    *output_key,
79df40
                        MetaOutputConfig *output_config,
79df40
                        int               mode_width,
79df40
                        int               mode_height,
79df40
                        GError          **error)
79df40
 {
79df40
   MetaMonitorModeSpec *mode_spec;
79df40
   MetaMonitorSpec *monitor_spec;
79df40
   MetaMonitorConfig *monitor_config;
79df40
 
79df40
   mode_spec = g_new0 (MetaMonitorModeSpec, 1);
79df40
   *mode_spec = (MetaMonitorModeSpec) {
79df40
     .width = mode_width,
79df40
     .height = mode_height,
79df40
     .refresh_rate = output_config->refresh_rate
79df40
   };
79df40
 
79df40
   if (!meta_verify_monitor_mode_spec (mode_spec, error))
79df40
     {
79df40
       g_free (mode_spec);
79df40
+      free_output_key (output_key);
79df40
       return NULL;
79df40
     }
79df40
 
79df40
   monitor_spec = g_new0 (MetaMonitorSpec, 1);
79df40
   *monitor_spec = (MetaMonitorSpec) {
79df40
     .connector = output_key->connector,
79df40
     .vendor = output_key->vendor,
79df40
     .product = output_key->product,
79df40
     .serial = output_key->serial
79df40
   };
79df40
 
79df40
   monitor_config = g_new0 (MetaMonitorConfig, 1);
79df40
   *monitor_config = (MetaMonitorConfig) {
79df40
     .monitor_spec = monitor_spec,
79df40
     .mode_spec = mode_spec,
79df40
     .enable_underscanning = output_config->is_underscanning
79df40
   };
79df40
 
79df40
   if (!meta_verify_monitor_config (monitor_config, error))
79df40
     {
79df40
       meta_monitor_config_free (monitor_config);
79df40
       return NULL;
79df40
     }
79df40
 
79df40
   return monitor_config;
79df40
 }
79df40
 
79df40
 typedef struct _MonitorTile
79df40
 {
79df40
   MetaOutputKey *output_key;
79df40
-- 
79df40
2.26.2
79df40