if (!ocsp)
return;
+ HA_SPIN_LOCK(OCSP_LOCK, &ocsp_tree_lock);
ocsp->refcount--;
if (ocsp->refcount <= 0) {
ebmb_delete(&ocsp->key);
free(ocsp);
}
+ HA_SPIN_UNLOCK(OCSP_LOCK, &ocsp_tree_lock);
}
void ssl_destroy_ocsp_update_task(void)
{
struct eb64_node *node, *next;
- struct certificate_ocsp *ocsp;
if (!ocsp_update_task)
return;
node = eb64_first(&ocsp_update_tree);
while (node) {
- ocsp = eb64_entry(node, struct certificate_ocsp, next_update);
next = eb64_next(node);
eb64_delete(node);
- ssl_sock_free_ocsp(ocsp);
node = next;
}
/* Reinsert the entry into the update list so that it can be updated later */
ssl_ocsp_update_insert(ocsp);
+ /* Release the reference kept on the updated ocsp response. */
+ ssl_sock_free_ocsp(ctx->cur_ocsp);
ctx->cur_ocsp = NULL;
HA_SPIN_LOCK(OCSP_LOCK, &ocsp_tree_lock);
* reinserted after the response is processed. */
eb64_delete(&ocsp->next_update);
+ ++ocsp->refcount;
ctx->cur_ocsp = ocsp;
HA_SPIN_UNLOCK(OCSP_LOCK, &ocsp_tree_lock);
if (ctx->cur_ocsp) {
/* Something went wrong, reinsert the entry in the tree. */
ssl_ocsp_update_insert(ctx->cur_ocsp);
+ /* Release the reference kept on the updated ocsp response. */
+ ssl_sock_free_ocsp(ctx->cur_ocsp);
ctx->cur_ocsp = NULL;
}
if (hc)
if (hc)
httpclient_stop_and_destroy(hc);
+ /* Release the reference kept on the updated ocsp response. */
+ ssl_sock_free_ocsp(ctx->cur_ocsp);
ctx->cur_ocsp = NULL;
ctx->hc = NULL;
ctx->flags = 0;