stream-gnutls: Fix use after free
parent
6a5ea71289
commit
4b5e4d628d
|
@ -64,6 +64,7 @@ static void stream_gnutls_destroy(struct stream* self)
|
|||
{
|
||||
stream_close(self);
|
||||
aml_unref(self->handler);
|
||||
free(self);
|
||||
}
|
||||
|
||||
static int stream_gnutls__flush(struct stream* self)
|
||||
|
@ -253,7 +254,7 @@ int stream_upgrade_to_tls(struct stream* self, void* context)
|
|||
aml_unref(self->handler);
|
||||
|
||||
self->handler = aml_handler_new(self->fd, stream_gnutls__on_event, self,
|
||||
free);
|
||||
NULL);
|
||||
assert(self->handler);
|
||||
|
||||
rc = aml_start(aml_get_default(), self->handler);
|
||||
|
|
|
@ -56,6 +56,7 @@ static void stream_tcp_destroy(struct stream* self)
|
|||
{
|
||||
stream_close(self);
|
||||
aml_unref(self->handler);
|
||||
free(self);
|
||||
}
|
||||
|
||||
static int stream_tcp__flush(struct stream* self)
|
||||
|
@ -267,7 +268,7 @@ struct stream* stream_new(int fd, stream_event_fn on_event, void* userdata)
|
|||
|
||||
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
|
||||
|
||||
self->handler = aml_handler_new(fd, stream_tcp__on_event, self, free);
|
||||
self->handler = aml_handler_new(fd, stream_tcp__on_event, self, NULL);
|
||||
if (!self->handler)
|
||||
goto failure;
|
||||
|
||||
|
|
Loading…
Reference in New Issue