Merge pull request #4131 from paul-elliott-arm/fix_crypto_leak
Fix memory leak in error case in psa_crypto
diff --git a/ChangeLog.d/fix_psa_crypto_leak.txt b/ChangeLog.d/fix_psa_crypto_leak.txt
new file mode 100644
index 0000000..6f9e5fe
--- /dev/null
+++ b/ChangeLog.d/fix_psa_crypto_leak.txt
@@ -0,0 +1,2 @@
+Bugfix
+ * Fix a memory leak in an error case in psa_generate_derived_key_internal().
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 68098e5..e3ba1d3 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -5100,7 +5100,7 @@
status = psa_allocate_buffer_to_slot( slot, bytes );
if( status != PSA_SUCCESS )
- return( status );
+ goto exit;
slot->attr.bits = (psa_key_bits_t) bits;
psa_key_attributes_t attributes = {