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

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