[openssl-commits] [openssl] master update
Matt Caswell
matt at openssl.org
Mon Mar 21 17:01:23 UTC 2016
The branch master has been updated
via 55327ddfc13d9b9e48fb2d5287e9698a9589790c (commit)
from 7188f1f650e1130dbf0574c8276c0eb8cdbf0617 (commit)
- Log -----------------------------------------------------------------
commit 55327ddfc13d9b9e48fb2d5287e9698a9589790c
Author: Steven Linsell <stevenx.linsell at intel.com>
Date: Sun Mar 20 23:00:13 2016 +0000
Fix memory leak where fdlookup linked list is not freed during
ASYNC_WAIT_CTX_free
Reviewed-by: Rich Salz <rsalz at openssl.org>
Reviewed-by: Matt Caswell <matt at openssl.org>
-----------------------------------------------------------------------
Summary of changes:
crypto/async/async_wait.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/crypto/async/async_wait.c b/crypto/async/async_wait.c
index 94f1a6b..ece995f 100644
--- a/crypto/async/async_wait.c
+++ b/crypto/async/async_wait.c
@@ -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);
More information about the openssl-commits
mailing list