提交 55327ddf 编写于 作者: S Steven Linsell 提交者: Matt Caswell

Fix memory leak where fdlookup linked list is not freed during

ASYNC_WAIT_CTX_free
Reviewed-by: NRich Salz <rsalz@openssl.org>
Reviewed-by: NMatt Caswell <matt@openssl.org>
上级 7188f1f6
......@@ -63,20 +63,22 @@ ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void)
void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx)
{
struct fd_lookup_st *curr;
struct fd_lookup_st *next;
if (ctx == NULL)
return;
curr = ctx->fds;
while (curr != NULL) {
if (curr->del) {
/* This one has already been deleted so do nothing */
curr = curr->next;
continue;
if (!curr->del) {
/* Only try and cleanup if it hasn't been marked deleted */
if (curr->cleanup != NULL)
curr->cleanup(ctx, curr->key, curr->fd, curr->custom_data);
}
if (curr->cleanup != NULL)
curr->cleanup(ctx, curr->key, curr->fd, curr->custom_data);
curr = curr->next;
/* Always free the fd_lookup_st */
next = curr->next;
OPENSSL_free(curr);
curr = next;
}
OPENSSL_free(ctx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册