diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c index 3dabaabd..05931e80 100644 --- a/src/plugins/crypto.c +++ b/src/plugins/crypto.c @@ -1479,7 +1479,6 @@ gboolean bd_crypto_luks_remove_key (const gchar *device, BDCryptoKeyslotContext return FALSE; } - crypt_safe_free (key_buf); crypt_free (cd); bd_utils_report_finished (progress_id, "Completed"); return TRUE; diff --git a/tests/crypto_test.py b/tests/crypto_test.py index 4d920c27..efe892b2 100644 --- a/tests/crypto_test.py +++ b/tests/crypto_test.py @@ -524,6 +524,9 @@ def _remove_key(self, create_fn): succ = BlockDev.crypto_luks_add_key(self.loop_dev, ctx, nctx2) self.assertTrue(succ) + nctx3 = BlockDev.CryptoKeyslotContext(keyfile=self.keyfile) + succ = BlockDev.crypto_luks_add_key(self.loop_dev, ctx, nctx3) + with self.assertRaises(GLib.GError): wctx = BlockDev.CryptoKeyslotContext(passphrase="wrong-passphrase") BlockDev.crypto_luks_remove_key(self.loop_dev, wctx) @@ -534,6 +537,9 @@ def _remove_key(self, create_fn): succ = BlockDev.crypto_luks_remove_key(self.loop_dev, nctx2) self.assertTrue(succ) + succ = BlockDev.crypto_luks_remove_key(self.loop_dev, nctx3) + self.assertTrue(succ) + @tag_test(TestTags.SLOW) def test_luks_remove_key(self): self._remove_key(self._luks_format)