Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
Remove double-free when SSL is used.
Browse files Browse the repository at this point in the history
Two PRs, #143 and #99, close a memory leak by freeing evhtp_t.ssl_ctx.
Since they modify the same function at different points within the
function, the memory is freed twice. This patch removes the second call
to SSL_CTX_free().

Releases are affected as follows:
before 1.2.7: evhtp_t.ssl_ctx is leaked
1.2.7 through 1.2.9: OK
1.2.10 and 1.2.11: evhtp_t.ssl_ctx is freed twice
  • Loading branch information
Jacob Marble committed Jan 29, 2016
1 parent a89d9b3 commit ee32b2a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions evhtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4250,7 +4250,7 @@ evhtp_free(evhtp_t * evhtp) {

#ifndef EVHTP_DISABLE_SSL
if (evhtp->ssl_ctx) {
SSL_CTX_free(evhtp->ssl_ctx);
evhtp_safe_free(evhtp->ssl_ctx, SSL_CTX_free);
}
#endif

Expand All @@ -4271,12 +4271,6 @@ evhtp_free(evhtp_t * evhtp) {
evhtp_safe_free(evhtp_alias, free);
}

#ifndef EVHTP_DISABLE_SSL
if (evhtp->ssl_ctx) {
SSL_CTX_free(evhtp->ssl_ctx);
}
#endif

evhtp_safe_free(evhtp, free);
} /* evhtp_free */

Expand Down

0 comments on commit ee32b2a

Please sign in to comment.