From 32075a17249636b3e2986a0ac422b1803663ccaa Mon Sep 17 00:00:00 2001 From: Petr Gotthard Date: Tue, 25 May 2021 15:39:01 +0200 Subject: [PATCH] Fix memory leak in OSSL_CMP_CTX The ctx->propq is strdup'ed, so it must be free'd too. Reviewed-by: Ben Kaduk Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/15458) --- crypto/cmp/cmp_ctx.c | 1 + crypto/cmp/cmp_local.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/cmp/cmp_ctx.c b/crypto/cmp/cmp_ctx.c index a09432597b..d1f8f27e13 100644 --- a/crypto/cmp/cmp_ctx.c +++ b/crypto/cmp/cmp_ctx.c @@ -179,6 +179,7 @@ void OSSL_CMP_CTX_free(OSSL_CMP_CTX *ctx) (void)OSSL_HTTP_close(ctx->http_ctx, 1); ossl_cmp_debug(ctx, "disconnected from CMP server"); } + OPENSSL_free(ctx->propq); OPENSSL_free(ctx->serverPath); OPENSSL_free(ctx->server); OPENSSL_free(ctx->proxy); diff --git a/crypto/cmp/cmp_local.h b/crypto/cmp/cmp_local.h index eee609937b..fec4916ed3 100644 --- a/crypto/cmp/cmp_local.h +++ b/crypto/cmp/cmp_local.h @@ -32,7 +32,7 @@ */ struct ossl_cmp_ctx_st { OSSL_LIB_CTX *libctx; - const char *propq; + char *propq; OSSL_CMP_log_cb_t log_cb; /* log callback for error/debug/etc. output */ OSSL_CMP_severity log_verbosity; /* level of verbosity of log output */