diff --git a/src/lib/plugin_apis/fs.api b/src/lib/plugin_apis/fs.api index 0f3ffe5e..44ee239e 100644 --- a/src/lib/plugin_apis/fs.api +++ b/src/lib/plugin_apis/fs.api @@ -339,6 +339,7 @@ BDFSVfatInfo* bd_fs_vfat_info_copy (BDFSVfatInfo *data) { ret->uuid = g_strdup (data->uuid); ret->cluster_size = data->cluster_size; ret->cluster_count = data->cluster_count; + ret->free_cluster_count = data->free_cluster_count; return ret; } diff --git a/src/lib/plugin_apis/lvm.api b/src/lib/plugin_apis/lvm.api index 23762dfb..d42baaa8 100644 --- a/src/lib/plugin_apis/lvm.api +++ b/src/lib/plugin_apis/lvm.api @@ -708,7 +708,9 @@ BDLVMCacheStats* bd_lvm_cache_stats_copy (BDLVMCacheStats *data) { * * Frees @data. */ -void bd_lvm_cache_stats_free (BDLVMLVdata *data) { +void bd_lvm_cache_stats_free (BDLVMCacheStats *data) { + if (data == NULL) + return; g_free (data); } diff --git a/src/lib/plugin_apis/mdraid.api b/src/lib/plugin_apis/mdraid.api index 10141281..f046bafa 100644 --- a/src/lib/plugin_apis/mdraid.api +++ b/src/lib/plugin_apis/mdraid.api @@ -172,6 +172,7 @@ BDMDDetailData* bd_md_detail_data_copy (BDMDDetailData *data) { new_data->array_size = data->array_size; new_data->use_dev_size = data->use_dev_size; new_data->raid_devices = data->raid_devices; + new_data->total_devices = data->total_devices; new_data->active_devices = data->active_devices; new_data->working_devices = data->working_devices; new_data->failed_devices = data->failed_devices; diff --git a/src/lib/plugin_apis/nvdimm.api b/src/lib/plugin_apis/nvdimm.api index ec92e0af..0e8e8e0c 100644 --- a/src/lib/plugin_apis/nvdimm.api +++ b/src/lib/plugin_apis/nvdimm.api @@ -79,7 +79,7 @@ BDNVDIMMNamespaceInfo* bd_nvdimm_namespace_info_copy (BDNVDIMMNamespaceInfo *inf BDNVDIMMNamespaceInfo *new_info = g_new0 (BDNVDIMMNamespaceInfo, 1); - new_info->dev = info->dev; + new_info->dev = g_strdup (info->dev); new_info->mode = info->mode; new_info->size = info->size; new_info->uuid = g_strdup (info->uuid); diff --git a/src/plugins/btrfs.c b/src/plugins/btrfs.c index e839b49e..419088be 100644 --- a/src/plugins/btrfs.c +++ b/src/plugins/btrfs.c @@ -172,7 +172,7 @@ gboolean bd_btrfs_is_tech_avail (BDBtrfsTech tech G_GNUC_UNUSED, guint64 mode G_ } static BDBtrfsDeviceInfo* get_device_info_from_match (GMatchInfo *match_info) { - BDBtrfsDeviceInfo *ret = g_new(BDBtrfsDeviceInfo, 1); + BDBtrfsDeviceInfo *ret = g_new0(BDBtrfsDeviceInfo, 1); gchar *item = NULL; BSSize size = NULL; BSError *error = NULL; @@ -213,7 +213,7 @@ static BDBtrfsDeviceInfo* get_device_info_from_match (GMatchInfo *match_info) { } static BDBtrfsSubvolumeInfo* get_subvolume_info_from_match (GMatchInfo *match_info) { - BDBtrfsSubvolumeInfo *ret = g_new(BDBtrfsSubvolumeInfo, 1); + BDBtrfsSubvolumeInfo *ret = g_new0(BDBtrfsSubvolumeInfo, 1); gchar *item = NULL; item = g_match_info_fetch_named (match_info, "id"); @@ -230,7 +230,7 @@ static BDBtrfsSubvolumeInfo* get_subvolume_info_from_match (GMatchInfo *match_in } static BDBtrfsFilesystemInfo* get_filesystem_info_from_match (GMatchInfo *match_info) { - BDBtrfsFilesystemInfo *ret = g_new(BDBtrfsFilesystemInfo, 1); + BDBtrfsFilesystemInfo *ret = g_new0(BDBtrfsFilesystemInfo, 1); gchar *item = NULL; BSSize size = NULL; BSError *error = NULL; diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c index 6acff94e..e801e30a 100644 --- a/src/plugins/crypto.c +++ b/src/plugins/crypto.c @@ -2561,6 +2561,8 @@ static gboolean get_subsystem_label (const gchar *device, gchar **subsystem, gch if (status != 0) { g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to get subsystem for the device '%s'", device); + g_free (*label); + *label = NULL; blkid_free_probe (probe); synced_close (fd); return FALSE; @@ -3285,7 +3287,6 @@ gboolean bd_crypto_tc_open_flags (const gchar *device, const gchar *name, BDCryp "Only 'passphrase' context type is valid for TC open."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); - crypt_free (cd); return FALSE; } diff --git a/src/plugins/lvm/lvm-dbus.c b/src/plugins/lvm/lvm-dbus.c index 8b24b0da..f6842c67 100644 --- a/src/plugins/lvm/lvm-dbus.c +++ b/src/plugins/lvm/lvm-dbus.c @@ -3714,7 +3714,7 @@ gboolean bd_lvm_cache_pool_convert (const gchar *vg_name, const gchar *data_lv, ret = call_lvm_obj_method_sync (vg_name, VG_INTF, "CreateCachePool", params, NULL, extra, TRUE, error); - if (!ret && name) + if (ret && name) bd_lvm_lvrename (vg_name, data_lv, name, NULL, error); return ret; diff --git a/src/plugins/nvdimm.c b/src/plugins/nvdimm.c index 962d2536..1c111eb3 100644 --- a/src/plugins/nvdimm.c +++ b/src/plugins/nvdimm.c @@ -577,6 +577,7 @@ BDNVDIMMNamespaceInfo** bd_nvdimm_list_namespaces (const gchar *bus_name, const } if (namespaces->len == 0) { + g_ptr_array_free (namespaces, TRUE); ndctl_unref (ctx); return NULL; } diff --git a/src/plugins/part.c b/src/plugins/part.c index faf8d451..1068b6e6 100644 --- a/src/plugins/part.c +++ b/src/plugins/part.c @@ -991,12 +991,11 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 if (status != 0) { g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, "Failed to get existing partitions on the device: %s", strerror_l (-status, c_locale)); - fdisk_unref_partition (npa); close_context (cxt); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return NULL; - } + } npa = fdisk_new_partition (); if (!npa) { diff --git a/tests/_lvm_cases.py b/tests/_lvm_cases.py index 7bda93f0..0e59f0da 100644 --- a/tests/_lvm_cases.py +++ b/tests/_lvm_cases.py @@ -1916,6 +1916,12 @@ def test_cache_pool_convert(self): succ = BlockDev.lvm_cache_pool_convert("testVG", "dataLV", "metadataLV", "testCache", None) self.assertTrue(succ) + # verify the cache pool exists under the requested name + info = BlockDev.lvm_lvinfo("testVG", "testCache") + self.assertIsNotNone(info) + self.assertEqual(info.lv_name, "testCache") + self.assertIn("C", info.attr) + @tag_test(TestTags.SLOW) def test_cache_pool_attach_detach(self): """Verify that is it possible to attach and detach a cache pool"""