Skip to content

Commit 89debac

Browse files
committed
Fixed janet_loop1_impl stream use after dealloc
1 parent c3e28bc commit 89debac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/ev.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,7 @@ void janet_loop1_impl(int has_timeout, JanetTimestamp timeout) {
19691969
JanetAsyncStatus status3 = JANET_ASYNC_STATUS_NOT_DONE;
19701970
JanetAsyncStatus status4 = JANET_ASYNC_STATUS_NOT_DONE;
19711971
state->event = pfd;
1972+
JanetStream *stream = state->stream;
19721973
if (mask & POLLOUT)
19731974
status1 = state->machine(state, JANET_ASYNC_EVENT_WRITE);
19741975
if (mask & POLLIN)
@@ -1983,7 +1984,6 @@ void janet_loop1_impl(int has_timeout, JanetTimestamp timeout) {
19831984
status4 == JANET_ASYNC_STATUS_DONE)
19841985
janet_unlisten(state, 0);
19851986
/* Close the stream if requested and no more listeners are left */
1986-
JanetStream *stream = state->stream;
19871987
if ((stream->flags & JANET_STREAM_TOCLOSE) && !stream->state) {
19881988
janet_stream_close(stream);
19891989
}

0 commit comments

Comments
 (0)