ts: fix memleaks caused by TS_VERIFY_CTX_set_imprint
authorzhaozg <zhaozg@gmail.com>
Wed, 18 Aug 2021 07:40:22 +0000 (15:40 +0800)
committerTomas Mraz <tomas@openssl.org>
Thu, 26 Aug 2021 09:06:06 +0000 (11:06 +0200)
CLA: trivial

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16347)

crypto/ts/ts_verify_ctx.c

index 747842168974246d13fc57d4f81cf57354010ccf..2f6f00c0ccd694747645ed3d5626421a1b173e5a 100644 (file)
@@ -70,6 +70,7 @@ STACK_OF(X509) *TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx,
 unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,
                                          unsigned char *hexstr, long len)
 {
+    OPENSSL_free(ctx->imprint);
     ctx->imprint = hexstr;
     ctx->imprint_len = len;
     return ctx->imprint;