neil / rpms / libblockdev

Forked from rpms/libblockdev a year ago
Clone

Blame 0003-Memory-leaks-fixes-backport.patch

Vojtech Trefny 75aaea
From 98cb3b9cf2046ba6e33db6ff400449c6a4827932 Mon Sep 17 00:00:00 2001
Vojtech Trefny 75aaea
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 75aaea
Date: Thu, 29 Apr 2021 12:38:49 +0200
Vojtech Trefny 75aaea
Subject: [PATCH 1/8] kbd: Fix memory leak
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
---
Vojtech Trefny 75aaea
 src/plugins/kbd.c | 1 +
Vojtech Trefny 75aaea
 1 file changed, 1 insertion(+)
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
diff --git a/src/plugins/kbd.c b/src/plugins/kbd.c
Vojtech Trefny 75aaea
index a2908ecb..d5ae0ed7 100644
Vojtech Trefny 75aaea
--- a/src/plugins/kbd.c
Vojtech Trefny 75aaea
+++ b/src/plugins/kbd.c
Vojtech Trefny 75aaea
@@ -1035,6 +1035,7 @@ gboolean bd_kbd_bcache_destroy (const gchar *bcache_device, GError **error) {
Vojtech Trefny 75aaea
 
Vojtech Trefny 75aaea
     if (c_set_uuid) {
Vojtech Trefny 75aaea
         path = g_strdup_printf ("/sys/fs/bcache/%s/stop", c_set_uuid);
Vojtech Trefny 75aaea
+        g_free (c_set_uuid);
Vojtech Trefny 75aaea
         success = bd_utils_echo_str_to_file ("1", path, error);
Vojtech Trefny 75aaea
         g_free (path);
Vojtech Trefny 75aaea
         if (!success) {
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
From c6d226c70996f6006a3f6eff13f8264f03e95c4f Mon Sep 17 00:00:00 2001
Vojtech Trefny 75aaea
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 75aaea
Date: Fri, 25 Sep 2020 14:22:58 +0200
Vojtech Trefny 75aaea
Subject: [PATCH 2/8] crypto: Fix memory leak
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
---
Vojtech Trefny 75aaea
 src/plugins/crypto.c | 1 +
Vojtech Trefny 75aaea
 1 file changed, 1 insertion(+)
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c
Vojtech Trefny 75aaea
index 1e7043fa..4fad9a85 100644
Vojtech Trefny 75aaea
--- a/src/plugins/crypto.c
Vojtech Trefny 75aaea
+++ b/src/plugins/crypto.c
Vojtech Trefny 75aaea
@@ -1275,6 +1275,7 @@ gboolean bd_crypto_luks_add_key (const gchar *device, const gchar *pass, const g
Vojtech Trefny 75aaea
         success = g_file_get_contents (nkey_file, &nkey_buf, &nbuf_len, error);
Vojtech Trefny 75aaea
         if (!success) {
Vojtech Trefny 75aaea
             g_prefix_error (error, "Failed to load key from file '%s': ", nkey_file);
Vojtech Trefny 75aaea
+            g_free (key_buf);
Vojtech Trefny 75aaea
             return FALSE;
Vojtech Trefny 75aaea
         }
Vojtech Trefny 75aaea
     } else
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
From 41b460fb81cf066e7ddc0bdda7f34db5e90b9f79 Mon Sep 17 00:00:00 2001
Vojtech Trefny 75aaea
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 75aaea
Date: Fri, 25 Sep 2020 14:23:24 +0200
Vojtech Trefny 75aaea
Subject: [PATCH 3/8] dm: Fix memory leak in the DM plugin and DM logging
Vojtech Trefny 75aaea
 redirect function
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
---
Vojtech Trefny 75aaea
 src/plugins/dm.c | 3 ++-
Vojtech Trefny 75aaea
 1 file changed, 2 insertions(+), 1 deletion(-)
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
diff --git a/src/plugins/dm.c b/src/plugins/dm.c
Vojtech Trefny 75aaea
index fb4e50b5..c9a735ed 100644
Vojtech Trefny 75aaea
--- a/src/plugins/dm.c
Vojtech Trefny 75aaea
+++ b/src/plugins/dm.c
Vojtech Trefny 75aaea
@@ -245,7 +245,8 @@ gchar* bd_dm_name_from_node (const gchar *dm_node, GError **error) {
Vojtech Trefny 75aaea
     g_free (sys_path);
Vojtech Trefny 75aaea
 
Vojtech Trefny 75aaea
     if (!success) {
Vojtech Trefny 75aaea
-        /* errror is already populated */
Vojtech Trefny 75aaea
+        /* error is already populated */
Vojtech Trefny 75aaea
+        g_free (ret);
Vojtech Trefny 75aaea
         return NULL;
Vojtech Trefny 75aaea
     }
Vojtech Trefny 75aaea
 
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
From 8d085fbb15c18ca91a5eff89192391c5a0b3bb7a Mon Sep 17 00:00:00 2001
Vojtech Trefny 75aaea
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 75aaea
Date: Fri, 25 Sep 2020 14:24:14 +0200
Vojtech Trefny 75aaea
Subject: [PATCH 4/8] fs: Fix memory leak
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
---
Vojtech Trefny 75aaea
 src/plugins/fs/mount.c | 1 +
Vojtech Trefny 75aaea
 1 file changed, 1 insertion(+)
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
diff --git a/src/plugins/fs/mount.c b/src/plugins/fs/mount.c
Vojtech Trefny 75aaea
index 43d64e8c..46e03ca4 100644
Vojtech Trefny 75aaea
--- a/src/plugins/fs/mount.c
Vojtech Trefny 75aaea
+++ b/src/plugins/fs/mount.c
Vojtech Trefny 75aaea
@@ -541,6 +541,7 @@ static gboolean run_as_user (MountFunc func, MountArgs *args, uid_t run_as_uid,
Vojtech Trefny 75aaea
                                        "Unknoen error while reading error.");
Vojtech Trefny 75aaea
                       g_io_channel_unref (channel);
Vojtech Trefny 75aaea
                       close (pipefd[0]);
Vojtech Trefny 75aaea
+                      g_free (error_msg);
Vojtech Trefny 75aaea
                       return FALSE;
Vojtech Trefny 75aaea
                   }
Vojtech Trefny 75aaea
 
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
From 6c45f4ef1fc898d71cc2f13670adb508a6037c66 Mon Sep 17 00:00:00 2001
Vojtech Trefny 75aaea
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 75aaea
Date: Fri, 25 Sep 2020 14:26:24 +0200
Vojtech Trefny 75aaea
Subject: [PATCH 5/8] kbd: Fix memory leak
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
---
Vojtech Trefny 75aaea
 src/plugins/kbd.c | 1 +
Vojtech Trefny 75aaea
 1 file changed, 1 insertion(+)
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
diff --git a/src/plugins/kbd.c b/src/plugins/kbd.c
Vojtech Trefny 75aaea
index d5ae0ed7..ff8bde17 100644
Vojtech Trefny 75aaea
--- a/src/plugins/kbd.c
Vojtech Trefny 75aaea
+++ b/src/plugins/kbd.c
Vojtech Trefny 75aaea
@@ -1255,6 +1255,7 @@ static gboolean get_cache_size_used (const gchar *cache_dev_sys, guint64 *size,
Vojtech Trefny 75aaea
     g_io_channel_unref (file);
Vojtech Trefny 75aaea
 
Vojtech Trefny 75aaea
     if (!found) {
Vojtech Trefny 75aaea
+        g_free (line);
Vojtech Trefny 75aaea
         g_set_error (error, BD_KBD_ERROR, BD_KBD_ERROR_BCACHE_INVAL,
Vojtech Trefny 75aaea
                      "Failed to get cache usage data");
Vojtech Trefny 75aaea
         return FALSE;
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
From 4f4e93dfca36421eb0e0cb2dec5d48df5bc2f363 Mon Sep 17 00:00:00 2001
Vojtech Trefny 75aaea
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 75aaea
Date: Fri, 25 Sep 2020 14:26:37 +0200
Vojtech Trefny 75aaea
Subject: [PATCH 6/8] lvm-dbus: Fix memory leak
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
---
Vojtech Trefny 75aaea
 src/plugins/lvm-dbus.c | 1 +
Vojtech Trefny 75aaea
 1 file changed, 1 insertion(+)
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
Vojtech Trefny 75aaea
index b7b4480e..144551f5 100644
Vojtech Trefny 75aaea
--- a/src/plugins/lvm-dbus.c
Vojtech Trefny 75aaea
+++ b/src/plugins/lvm-dbus.c
Vojtech Trefny 75aaea
@@ -2927,6 +2927,7 @@ gboolean bd_lvm_cache_detach (const gchar *vg_name, const gchar *cached_lv, gboo
Vojtech Trefny 75aaea
     lv_id = g_strdup_printf ("%s/%s", vg_name, cached_lv);
Vojtech Trefny 75aaea
     call_lvm_obj_method_sync (lv_id, CACHED_LV_INTF, "DetachCachePool", params, NULL, extra, TRUE, error);
Vojtech Trefny 75aaea
     g_free (lv_id);
Vojtech Trefny 75aaea
+    g_free (cache_pool_name);
Vojtech Trefny 75aaea
     return ((*error) == NULL);
Vojtech Trefny 75aaea
 }
Vojtech Trefny 75aaea
 
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
From 410a10bc2cfceeb550d72456573d4722b4207ddc Mon Sep 17 00:00:00 2001
Vojtech Trefny 75aaea
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 75aaea
Date: Fri, 25 Sep 2020 14:27:22 +0200
Vojtech Trefny 75aaea
Subject: [PATCH 7/8] mdraid: Fix memory leak
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
---
Vojtech Trefny 75aaea
 src/plugins/mdraid.c | 1 +
Vojtech Trefny 75aaea
 1 file changed, 1 insertion(+)
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
diff --git a/src/plugins/mdraid.c b/src/plugins/mdraid.c
Vojtech Trefny 75aaea
index 74af744c..b97bc641 100644
Vojtech Trefny 75aaea
--- a/src/plugins/mdraid.c
Vojtech Trefny 75aaea
+++ b/src/plugins/mdraid.c
Vojtech Trefny 75aaea
@@ -1332,6 +1332,7 @@ gchar* bd_md_name_from_node (const gchar *node, GError **error) {
Vojtech Trefny 75aaea
             continue;
Vojtech Trefny 75aaea
         }
Vojtech Trefny 75aaea
         node_name = g_path_get_basename (dev_path);
Vojtech Trefny 75aaea
+        g_free (dev_path);
Vojtech Trefny 75aaea
         if (g_strcmp0 (node_name, node) == 0) {
Vojtech Trefny 75aaea
             found = TRUE;
Vojtech Trefny 75aaea
             name = g_path_get_basename (*path_p);
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
From 0d49e5d190e24fa89ae2795714d0276f24285b19 Mon Sep 17 00:00:00 2001
Vojtech Trefny 75aaea
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 75aaea
Date: Fri, 25 Sep 2020 14:27:54 +0200
Vojtech Trefny 75aaea
Subject: [PATCH 8/8] swap: Fix memory leak
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
---
Vojtech Trefny 75aaea
 src/plugins/swap.c | 1 +
Vojtech Trefny 75aaea
 1 file changed, 1 insertion(+)
Vojtech Trefny 75aaea
Vojtech Trefny 75aaea
diff --git a/src/plugins/swap.c b/src/plugins/swap.c
Vojtech Trefny 75aaea
index 102780a7..115f8fca 100644
Vojtech Trefny 75aaea
--- a/src/plugins/swap.c
Vojtech Trefny 75aaea
+++ b/src/plugins/swap.c
Vojtech Trefny 75aaea
@@ -417,6 +417,7 @@ gboolean bd_swap_swapstatus (const gchar *device, GError **error) {
Vojtech Trefny 75aaea
         if (!real_device) {
Vojtech Trefny 75aaea
             /* the device doesn't exist and thus is not an active swap */
Vojtech Trefny 75aaea
             g_clear_error (error);
Vojtech Trefny 75aaea
+            g_free (file_content);
Vojtech Trefny 75aaea
             return FALSE;
Vojtech Trefny 75aaea
         }
Vojtech Trefny 75aaea
     }