From: Remi Tricot-Le Breton Date: Thu, 1 Oct 2026 14:59:23 +0000 (+0200) Subject: MINOR: ocsp: Remove free of main structure from ssl_sock_free_ocsp_data X-Git-Tag: v3.5-dev9~224 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=7d56b4a5a030b1965c387d3212dc22cdf98958fa;p=haproxy.git MINOR: ocsp: Remove free of main structure from ssl_sock_free_ocsp_data The 'ssl_sock_free_ocsp_data' now only frees the contents of the 'certificate_ocsp' while leaving the actual structure unfreed. This will allow to keep certificate_ocsp structures on the stack later. --- diff --git a/src/ssl_ocsp.c b/src/ssl_ocsp.c index 42f7d8761..1ed6eaf99 100644 --- a/src/ssl_ocsp.c +++ b/src/ssl_ocsp.c @@ -473,7 +473,6 @@ static void ssl_sock_free_ocsp_data(struct certificate_ocsp *ocsp) ha_free(&ocsp->uri); } ha_free(&ocsp->last_update_error); - free(ocsp); } /* @@ -494,8 +493,10 @@ void ssl_sock_free_ocsp(struct certificate_ocsp *ocsp) * ckch_store was deleted or changed (via cli commands for * instance). */ - if (ocsp->refcount <= 0) + if (ocsp->refcount <= 0) { ssl_sock_free_ocsp_data(ocsp); + free(ocsp); + } } HA_SPIN_UNLOCK(OCSP_LOCK, &ocsp_tree_lock); } @@ -514,9 +515,10 @@ void ssl_sock_free_ocsp_instance(struct certificate_ocsp *ocsp) * ckch_store was deleted or changed (via cli commands for * instance). */ - if (ocsp->refcount_store <= 0) + if (ocsp->refcount_store <= 0) { ssl_sock_free_ocsp_data(ocsp); - + free(ocsp); + } } HA_SPIN_UNLOCK(OCSP_LOCK, &ocsp_tree_lock); }