From 8cfb5651175f2362f0cdff5641d0736cc5a6ad63 Mon Sep 17 00:00:00 2001 From: DONGGEUN YOO Date: Mon, 29 Sep 2025 00:45:11 +0000 Subject: [PATCH] ts_conf: fix memory leak in TS_CONF_set_policies Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/28686) (cherry picked from commit 1f3a6602a13b382c0f09d6659e0d49ec2e41646d) --- crypto/ts/ts_conf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c index 158e1c42425..af687b7ceb4 100644 --- a/crypto/ts/ts_conf.c +++ b/crypto/ts/ts_conf.c @@ -330,8 +330,10 @@ int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx) ts_CONF_invalid(section, ENV_OTHER_POLICIES); goto err; } - if (!TS_RESP_CTX_add_policy(ctx, objtmp)) + if (!TS_RESP_CTX_add_policy(ctx, objtmp)) { + ASN1_OBJECT_free(objtmp); goto err; + } ASN1_OBJECT_free(objtmp); } -- 2.47.3