Skip to content

Commit 0dbb23c

Browse files
committed
Fix memory leak in gcm_kma API
This shows up when building with --enable-sanitizer Suggested-by: Ingo Franzki <ifranzki@linux.ibm.com> Signed-off-by: Joerg Schmidbauer <jschmidb@de.ibm.com>
1 parent 79c2156 commit 0dbb23c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/ica_api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4123,6 +4123,12 @@ int ica_aes_gcm_kma_init_internal(unsigned int direction,
41234123
return EINVAL;
41244124
}
41254125

4126+
if (ctx->iv_allocated_internally == 1) {
4127+
OPENSSL_cleanse((void*)ctx->iv, ctx->iv_length);
4128+
free(ctx->iv);
4129+
ctx->iv_allocated_internally = 0;
4130+
}
4131+
41264132
if (iv == NULL) {
41274133
/* If the iv is NULL, create it internally via an approved
41284134
* random source. The application can obtain the internal iv

0 commit comments

Comments
 (0)