From ffd73a00434b06093c1923e4179358628b3cd103 Mon Sep 17 00:00:00 2001 From: Dmitrij Tejblum Date: Mon, 30 Aug 1999 15:45:42 +0000 Subject: Fix a memory leak: free the thread-specific poll_data, used in the select() implementation. PR: 13368 Submitted by: Steve Bernacki, Jr. --- lib/libc_r/uthread/uthread_exit.c | 6 ++++++ lib/libkse/thread/thr_exit.c | 6 ++++++ lib/libpthread/thread/thr_exit.c | 6 ++++++ 3 files changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/libc_r/uthread/uthread_exit.c b/lib/libc_r/uthread/uthread_exit.c index c9894435748d..795decce0b4f 100644 --- a/lib/libc_r/uthread/uthread_exit.c +++ b/lib/libc_r/uthread/uthread_exit.c @@ -134,6 +134,12 @@ pthread_exit(void *status) _thread_cleanupspecific(); } + /* Free thread-specific poll_data structure, if allocated */ + if (_thread_run->poll_data.fds != NULL) { + free(_thread_run->poll_data.fds); + _thread_run->poll_data.fds = NULL; + } + /* * Defer signals to protect the scheduling queues from access * by the signal handler: diff --git a/lib/libkse/thread/thr_exit.c b/lib/libkse/thread/thr_exit.c index c9894435748d..795decce0b4f 100644 --- a/lib/libkse/thread/thr_exit.c +++ b/lib/libkse/thread/thr_exit.c @@ -134,6 +134,12 @@ pthread_exit(void *status) _thread_cleanupspecific(); } + /* Free thread-specific poll_data structure, if allocated */ + if (_thread_run->poll_data.fds != NULL) { + free(_thread_run->poll_data.fds); + _thread_run->poll_data.fds = NULL; + } + /* * Defer signals to protect the scheduling queues from access * by the signal handler: diff --git a/lib/libpthread/thread/thr_exit.c b/lib/libpthread/thread/thr_exit.c index c9894435748d..795decce0b4f 100644 --- a/lib/libpthread/thread/thr_exit.c +++ b/lib/libpthread/thread/thr_exit.c @@ -134,6 +134,12 @@ pthread_exit(void *status) _thread_cleanupspecific(); } + /* Free thread-specific poll_data structure, if allocated */ + if (_thread_run->poll_data.fds != NULL) { + free(_thread_run->poll_data.fds); + _thread_run->poll_data.fds = NULL; + } + /* * Defer signals to protect the scheduling queues from access * by the signal handler: -- cgit v1.3