Skip to content

Commit cf25bb6

Browse files
committed
fix use-after-free due to race condition with ASAN enabled
1 parent 4b074be commit cf25bb6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/internal/event_loop/thread_pool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,14 @@ void *worker_loop(void *data) {
120120
#endif
121121

122122
while (job) {
123+
int job_id = job->job_id;
123124
job->ret = 0;
124125
job->err = 0;
125126

126127
job->worker(job);
127128

128129
self->waiting = 1;
129-
write(pool.notify_send, &(job->job_id), sizeof(int));
130+
write(pool.notify_send, &job_id, sizeof(int));
130131

131132
#ifdef WAKEUP_METHOD_SIGNAL
132133
sigwait(&pool.wakeup_signal, &sig);

0 commit comments

Comments
 (0)