Fix a possible crash with SSL connections closing early.

libratbox r25356 (jilles)
This commit is contained in:
Jilles Tjoelker 2008-05-12 19:54:24 +02:00
parent 98686f18e9
commit b68b0b2cde
1 changed files with 6 additions and 4 deletions

View File

@ -82,6 +82,7 @@ rb_ssl_tryaccept(rb_fde_t * F, void *data)
int ssl_err; int ssl_err;
lrb_assert(F->accept != NULL); lrb_assert(F->accept != NULL);
int flags; int flags;
struct acceptdata *ad;
if(!SSL_is_init_finished((SSL *) F->ssl)) if(!SSL_is_init_finished((SSL *) F->ssl))
{ {
@ -112,10 +113,11 @@ rb_ssl_tryaccept(rb_fde_t * F, void *data)
rb_settimeout(F, 0, NULL, NULL); rb_settimeout(F, 0, NULL, NULL);
rb_setselect(F, RB_SELECT_READ | RB_SELECT_WRITE, NULL, NULL); rb_setselect(F, RB_SELECT_READ | RB_SELECT_WRITE, NULL, NULL);
F->accept->callback(F, RB_OK, (struct sockaddr *) &F->accept->S, F->accept->addrlen, ad = F->accept;
F->accept->data);
rb_free(F->accept);
F->accept = NULL; F->accept = NULL;
ad->callback(F, RB_OK, (struct sockaddr *) &ad->S, ad->addrlen,
ad->data);
rb_free(ad);
} }