Blame SOURCES/0002-boot-splash-fix-memory-leak-in-error-path.patch

ff210d
From c9a698d7840fca23cbaa205262a094e4f8648bb3 Mon Sep 17 00:00:00 2001
ff210d
From: Ray Strode <rstrode@redhat.com>
ff210d
Date: Mon, 15 Oct 2018 21:04:47 -0400
ff210d
Subject: [PATCH 2/6] boot-splash: fix memory leak in error path
ff210d
ff210d
If the splash key file fails to load, we don't free
ff210d
the associated key file object.
ff210d
ff210d
This commit fixes that.
ff210d
---
ff210d
 src/libply-splash-core/ply-boot-splash.c | 4 +++-
ff210d
 1 file changed, 3 insertions(+), 1 deletion(-)
ff210d
ff210d
diff --git a/src/libply-splash-core/ply-boot-splash.c b/src/libply-splash-core/ply-boot-splash.c
ff210d
index 87a7a0c..54f8585 100644
ff210d
--- a/src/libply-splash-core/ply-boot-splash.c
ff210d
+++ b/src/libply-splash-core/ply-boot-splash.c
ff210d
@@ -181,62 +181,64 @@ void
ff210d
 ply_boot_splash_remove_text_display (ply_boot_splash_t  *splash,
ff210d
                                      ply_text_display_t *display)
ff210d
 {
ff210d
         int number_of_columns, number_of_rows;
ff210d
 
ff210d
         if (splash->plugin_interface->remove_text_display == NULL)
ff210d
                 return;
ff210d
 
ff210d
         number_of_columns = ply_text_display_get_number_of_columns (display);
ff210d
         number_of_rows = ply_text_display_get_number_of_rows (display);
ff210d
 
ff210d
         ply_trace ("removing %dx%d text display", number_of_columns, number_of_rows);
ff210d
 
ff210d
         splash->plugin_interface->remove_text_display (splash->plugin, display);
ff210d
         ply_list_remove_data (splash->text_displays, display);
ff210d
 }
ff210d
 
ff210d
 bool
ff210d
 ply_boot_splash_load (ply_boot_splash_t *splash)
ff210d
 {
ff210d
         ply_key_file_t *key_file;
ff210d
         char *module_name;
ff210d
         char *module_path;
ff210d
 
ff210d
         assert (splash != NULL);
ff210d
 
ff210d
         get_plugin_interface_function_t get_boot_splash_plugin_interface;
ff210d
 
ff210d
         key_file = ply_key_file_new (splash->theme_path);
ff210d
 
ff210d
-        if (!ply_key_file_load (key_file))
ff210d
+        if (!ply_key_file_load (key_file)) {
ff210d
+                ply_key_file_free (key_file);
ff210d
                 return false;
ff210d
+        }
ff210d
 
ff210d
         module_name = ply_key_file_get_value (key_file, "Plymouth Theme", "ModuleName");
ff210d
 
ff210d
         asprintf (&module_path, "%s%s.so",
ff210d
                   splash->plugin_dir, module_name);
ff210d
         free (module_name);
ff210d
 
ff210d
         splash->module_handle = ply_open_module (module_path);
ff210d
 
ff210d
         free (module_path);
ff210d
 
ff210d
         if (splash->module_handle == NULL) {
ff210d
                 ply_key_file_free (key_file);
ff210d
                 return false;
ff210d
         }
ff210d
 
ff210d
         get_boot_splash_plugin_interface = (get_plugin_interface_function_t)
ff210d
                                            ply_module_look_up_function (splash->module_handle,
ff210d
                                                                         "ply_boot_splash_plugin_get_interface");
ff210d
 
ff210d
         if (get_boot_splash_plugin_interface == NULL) {
ff210d
                 ply_save_errno ();
ff210d
                 ply_close_module (splash->module_handle);
ff210d
                 splash->module_handle = NULL;
ff210d
                 ply_key_file_free (key_file);
ff210d
                 ply_restore_errno ();
ff210d
                 return false;
ff210d
         }
ff210d
 
ff210d
         splash->plugin_interface = get_boot_splash_plugin_interface ();
ff210d
-- 
ff210d
2.17.1
ff210d