mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 11:50:10 +01:00
Fix some warning and leaks in api test code.
This commit is contained in:
@@ -259,7 +259,9 @@ static void _cleanup(void)
|
||||
_system("rm -f " IMAGE1, 0);
|
||||
_system("rm -rf " CONV_DIR, 0);
|
||||
|
||||
if (test_loop_file)
|
||||
remove(test_loop_file);
|
||||
if (tmp_file_1)
|
||||
remove(tmp_file_1);
|
||||
|
||||
remove(VALID_LUKS2_HEADER);
|
||||
|
||||
@@ -199,7 +199,9 @@ static void _cleanup(void)
|
||||
_system("rm -f " IMAGE_EMPTY, 0);
|
||||
_system("rm -f " IMAGE1, 0);
|
||||
|
||||
if (test_loop_file)
|
||||
remove(test_loop_file);
|
||||
if (tmp_file_1)
|
||||
remove(tmp_file_1);
|
||||
|
||||
remove(EVL_HEADER_1);
|
||||
|
||||
@@ -301,10 +301,13 @@ static int t_dm_satisfies_version(unsigned target_maj, unsigned target_min,
|
||||
static void t_dm_set_crypt_compat(const char *dm_version, unsigned crypt_maj,
|
||||
unsigned crypt_min, unsigned crypt_patch)
|
||||
{
|
||||
unsigned dm_maj, dm_min, dm_patch;
|
||||
unsigned dm_maj = 0, dm_min = 0, dm_patch = 0;
|
||||
|
||||
if (sscanf(dm_version, "%u.%u.%u", &dm_maj, &dm_min, &dm_patch) != 3)
|
||||
dm_maj = dm_min = dm_patch = 0;
|
||||
if (sscanf(dm_version, "%u.%u.%u", &dm_maj, &dm_min, &dm_patch) != 3) {
|
||||
dm_maj = 0;
|
||||
dm_min = 0;
|
||||
dm_patch = 0;
|
||||
}
|
||||
|
||||
if (t_dm_satisfies_version(1, 2, crypt_maj, crypt_min))
|
||||
t_dm_crypt_flags |= T_DM_KEY_WIPE_SUPPORTED;
|
||||
@@ -372,6 +375,9 @@ int t_dm_check_versions(void)
|
||||
if (!dm_task_run(dmt))
|
||||
goto out;
|
||||
|
||||
if (!dm_task_get_driver_version(dmt, dm_version, sizeof(dm_version)))
|
||||
goto out;
|
||||
|
||||
target = dm_task_get_versions(dmt);
|
||||
do {
|
||||
last_target = target;
|
||||
|
||||
Reference in New Issue
Block a user