]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/cmp.c: make management of http_cb_arg pointer more robust
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Tue, 30 May 2023 19:14:51 +0000 (21:14 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Thu, 1 Jun 2023 08:03:06 +0000 (10:03 +0200)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/21086)

apps/cmp.c

index 18fd16625f30f9a5de1696b52c3af2caa97e5003..fa2f49585f04e469b240cef6b58a26ba59068d38 100644 (file)
@@ -1984,6 +1984,7 @@ static int setup_client_ctx(OSSL_CMP_CTX *ctx, ENGINE *engine)
 
         if ((info = OPENSSL_zalloc(sizeof(*info))) == NULL)
             goto err;
+        APP_HTTP_TLS_INFO_free(OSSL_CMP_CTX_get_http_cb_arg(ctx));
         (void)OSSL_CMP_CTX_set_http_cb_arg(ctx, info);
         info->ssl_ctx = setup_ssl_ctx(ctx, host, engine);
         info->server = host;
@@ -3158,6 +3159,7 @@ int cmp_main(int argc, char **argv)
 #ifndef OPENSSL_NO_SOCK
         APP_HTTP_TLS_INFO *info = OSSL_CMP_CTX_get_http_cb_arg(cmp_ctx);
 
+        (void)OSSL_CMP_CTX_set_http_cb_arg(cmp_ctx, NULL);
 #endif
         ossl_cmp_mock_srv_free(OSSL_CMP_CTX_get_transfer_cb_arg(cmp_ctx));
         X509_STORE_free(OSSL_CMP_CTX_get_certConf_cb_arg(cmp_ctx));