|
|
e64f66 |
diff --git a/lib/kmip.c b/lib/kmip.c
|
|
|
e64f66 |
index dda819a..333603c 100644
|
|
|
e64f66 |
--- a/lib/kmip.c
|
|
|
e64f66 |
+++ b/lib/kmip.c
|
|
|
e64f66 |
@@ -1152,6 +1152,7 @@ kmip_decode_key_value (struct kmip_decoding_state *kmip,
|
|
|
e64f66 |
break;
|
|
|
e64f66 |
|
|
|
e64f66 |
default:
|
|
|
e64f66 |
+ kmip_key_value_free (res);
|
|
|
e64f66 |
g_return_val_if_reached (-1);
|
|
|
e64f66 |
}
|
|
|
e64f66 |
res->attributes = g_ptr_array_new ();
|
|
|
e64f66 |
@@ -1348,6 +1349,7 @@ kmip_decode_object_symmetric_key (struct kmip_decoding_state *kmip,
|
|
|
e64f66 |
g_snprintf (num, sizeof (num), "%" G_GUINT32_FORMAT, res->block->type);
|
|
|
e64f66 |
g_set_error (error, LIBVK_ERROR, LIBVK_ERROR_KMIP_UNSUPPORTED_VALUE,
|
|
|
e64f66 |
_("Unsupported symmetric key format %s"), num);
|
|
|
e64f66 |
+ kmip_object_symmetric_key_free (res);
|
|
|
e64f66 |
return -1;
|
|
|
e64f66 |
}
|
|
|
e64f66 |
*obj = res;
|
|
|
e64f66 |
@@ -1384,6 +1386,7 @@ kmip_decode_object_secret_data (struct kmip_decoding_state *kmip,
|
|
|
e64f66 |
g_snprintf (num, sizeof (num), "%" G_GUINT32_FORMAT, res->block->type);
|
|
|
e64f66 |
g_set_error (error, LIBVK_ERROR, LIBVK_ERROR_KMIP_UNSUPPORTED_VALUE,
|
|
|
e64f66 |
_("Unsupported symmetric key format %s"), num);
|
|
|
e64f66 |
+ kmip_object_secret_data_free (res);
|
|
|
e64f66 |
return -1;
|
|
|
e64f66 |
}
|
|
|
e64f66 |
*obj = res;
|
|
|
e64f66 |
diff --git a/lib/volume_luks.c b/lib/volume_luks.c
|
|
|
e64f66 |
index d1c5d47..4d32d9b 100644
|
|
|
e64f66 |
--- a/lib/volume_luks.c
|
|
|
e64f66 |
+++ b/lib/volume_luks.c
|
|
|
e64f66 |
@@ -547,8 +547,8 @@ luks_apply_secret (struct libvk_volume *vol, const struct libvk_volume *packet,
|
|
|
e64f66 |
}
|
|
|
e64f66 |
g_free (last_log_entry);
|
|
|
e64f66 |
|
|
|
e64f66 |
- g_return_val_if_fail (vol->v.luks->key_bytes == packet->v.luks->key_bytes,
|
|
|
e64f66 |
- -1);
|
|
|
e64f66 |
+ if (vol->v.luks->key_bytes != packet->v.luks->key_bytes)
|
|
|
e64f66 |
+ goto err_passphrase;
|
|
|
e64f66 |
luks_replace_key (vol, packet->v.luks->key);
|
|
|
e64f66 |
luks_replace_passphrase (vol, passphrase);
|
|
|
e64f66 |
vol->v.luks->passphrase_slot = res;
|
|
|
e64f66 |
diff --git a/src/volume_key.c b/src/volume_key.c
|
|
|
e64f66 |
index 074b187..24b70d6 100644
|
|
|
e64f66 |
--- a/src/volume_key.c
|
|
|
e64f66 |
+++ b/src/volume_key.c
|
|
|
e64f66 |
@@ -735,6 +735,11 @@ write_packet (struct packet_output_state *pos, const char *filename,
|
|
|
e64f66 |
|| g_file_set_contents (filename, packet, size, error) == FALSE)
|
|
|
e64f66 |
{
|
|
|
e64f66 |
g_prefix_error (error, _("Error creating `%s': "), filename);
|
|
|
e64f66 |
+ if (packet != NULL) {
|
|
|
e64f66 |
+ if (output_format_cleartext != 0)
|
|
|
e64f66 |
+ memset (packet, 0, size);
|
|
|
e64f66 |
+ g_free (packet);
|
|
|
e64f66 |
+ }
|
|
|
e64f66 |
return -1;
|
|
|
e64f66 |
}
|
|
|
e64f66 |
if (output_format_cleartext != 0)
|