summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordt <dt@FreeBSD.org>1999-08-30 15:45:42 +0000
committerdt <dt@FreeBSD.org>1999-08-30 15:45:42 +0000
commit0c0843ee5ccb3f63c49a7656ae2c80c28020726f (patch)
treeebbbcbd18e99bf1b48db2d0bbd1b07636f58e3c8 /lib
parent7b6ca448b139defb098de9a60816d7383e532293 (diff)
downloadFreeBSD-src-0c0843ee5ccb3f63c49a7656ae2c80c28020726f.zip
FreeBSD-src-0c0843ee5ccb3f63c49a7656ae2c80c28020726f.tar.gz
Fix a memory leak: free the thread-specific poll_data, used in the select()
implementation. PR: 13368 Submitted by: Steve Bernacki, Jr. <steve@copacetic.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/libc_r/uthread/uthread_exit.c6
-rw-r--r--lib/libkse/thread/thr_exit.c6
-rw-r--r--lib/libpthread/thread/thr_exit.c6
3 files changed, 18 insertions, 0 deletions
diff --git a/lib/libc_r/uthread/uthread_exit.c b/lib/libc_r/uthread/uthread_exit.c
index c989443..795decc 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 c989443..795decc 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 c989443..795decc 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:
OpenPOWER on IntegriCloud