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