|
| 1 | +diff --git a/lib/kmip.c b/lib/kmip.c |
| 2 | +index dda819a..333603c 100644 |
| 3 | +--- a/lib/kmip.c |
| 4 | ++++ b/lib/kmip.c |
| 5 | +@@ -1152,6 +1152,7 @@ kmip_decode_key_value (struct kmip_decoding_state *kmip, |
| 6 | + break; |
| 7 | + |
| 8 | + default: |
| 9 | ++ kmip_key_value_free (res); |
| 10 | + g_return_val_if_reached (-1); |
| 11 | + } |
| 12 | + res->attributes = g_ptr_array_new (); |
| 13 | +@@ -1348,6 +1349,7 @@ kmip_decode_object_symmetric_key (struct kmip_decoding_state *kmip, |
| 14 | + g_snprintf (num, sizeof (num), "%" G_GUINT32_FORMAT, res->block->type); |
| 15 | + g_set_error (error, LIBVK_ERROR, LIBVK_ERROR_KMIP_UNSUPPORTED_VALUE, |
| 16 | + _("Unsupported symmetric key format %s"), num); |
| 17 | ++ kmip_object_symmetric_key_free (res); |
| 18 | + return -1; |
| 19 | + } |
| 20 | + *obj = res; |
| 21 | +@@ -1384,6 +1386,7 @@ kmip_decode_object_secret_data (struct kmip_decoding_state *kmip, |
| 22 | + g_snprintf (num, sizeof (num), "%" G_GUINT32_FORMAT, res->block->type); |
| 23 | + g_set_error (error, LIBVK_ERROR, LIBVK_ERROR_KMIP_UNSUPPORTED_VALUE, |
| 24 | + _("Unsupported symmetric key format %s"), num); |
| 25 | ++ kmip_object_secret_data_free (res); |
| 26 | + return -1; |
| 27 | + } |
| 28 | + *obj = res; |
| 29 | +diff --git a/lib/volume_luks.c b/lib/volume_luks.c |
| 30 | +index d1c5d47..4d32d9b 100644 |
| 31 | +--- a/lib/volume_luks.c |
| 32 | ++++ b/lib/volume_luks.c |
| 33 | +@@ -547,8 +547,8 @@ luks_apply_secret (struct libvk_volume *vol, const struct libvk_volume *packet, |
| 34 | + } |
| 35 | + g_free (last_log_entry); |
| 36 | + |
| 37 | +- g_return_val_if_fail (vol->v.luks->key_bytes == packet->v.luks->key_bytes, |
| 38 | +- -1); |
| 39 | ++ if (vol->v.luks->key_bytes != packet->v.luks->key_bytes) |
| 40 | ++ goto err_passphrase; |
| 41 | + luks_replace_key (vol, packet->v.luks->key); |
| 42 | + luks_replace_passphrase (vol, passphrase); |
| 43 | + vol->v.luks->passphrase_slot = res; |
| 44 | +diff --git a/src/volume_key.c b/src/volume_key.c |
| 45 | +index 074b187..24b70d6 100644 |
| 46 | +--- a/src/volume_key.c |
| 47 | ++++ b/src/volume_key.c |
| 48 | +@@ -735,6 +735,11 @@ write_packet (struct packet_output_state *pos, const char *filename, |
| 49 | + || g_file_set_contents (filename, packet, size, error) == FALSE) |
| 50 | + { |
| 51 | + g_prefix_error (error, _("Error creating `%s': "), filename); |
| 52 | ++ if (packet != NULL) { |
| 53 | ++ if (output_format_cleartext != 0) |
| 54 | ++ memset (packet, 0, size); |
| 55 | ++ g_free (packet); |
| 56 | ++ } |
| 57 | + return -1; |
| 58 | + } |
| 59 | + if (output_format_cleartext != 0) |
0 commit comments