Skip to content

Commit 19b87d2

Browse files
ifranzkit8m
authored andcommitted
s390x: Fix memory leak in s390x_HMAC_CTX_copy()
When s390x_HMAC_CTX_copy() is called, but the destination context already has a buffer allocated, it is not freed before duplicating the buffer from the source context. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from #25238)
1 parent fe1ce91 commit 19b87d2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

crypto/hmac/hmac_s390x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ int s390x_HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)
263263
memcpy(&dctx->plat.s390x.param, &sctx->plat.s390x.param,
264264
sizeof(dctx->plat.s390x.param));
265265

266+
OPENSSL_clear_free(dctx->plat.s390x.buf, dctx->plat.s390x.size);
266267
dctx->plat.s390x.buf = NULL;
267268
if (sctx->plat.s390x.buf != NULL) {
268269
dctx->plat.s390x.buf = OPENSSL_memdup(sctx->plat.s390x.buf,

0 commit comments

Comments
 (0)