aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread.c
diff options
context:
space:
mode:
authorPaul Eggert2019-03-27 20:58:34 -0700
committerPaul Eggert2019-03-27 21:24:25 -0700
commit361e88986f3580a7433a23eec1cf01408e5e3627 (patch)
treee93e6a8c2bf790f5c6d88679a434a55d725160fe /src/thread.c
parent4da44cdaaf792c96164ba60076866a9df4d76002 (diff)
downloademacs-361e88986f3580a7433a23eec1cf01408e5e3627.tar.gz
emacs-361e88986f3580a7433a23eec1cf01408e5e3627.zip
Fix search_regs memory leak when thread destroyed
* src/thread.c (free_search_regs): New function. (finalize_one_thread): Use it.
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/thread.c b/src/thread.c
index 59e5b6617e3..e51d6144347 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -768,9 +768,21 @@ run_thread (void *state)
768 return NULL; 768 return NULL;
769} 769}
770 770
771static void
772free_search_regs (struct re_registers *regs)
773{
774 if (regs->num_regs != 0)
775 {
776 xfree (regs->start);
777 xfree (regs->end);
778 }
779}
780
771void 781void
772finalize_one_thread (struct thread_state *state) 782finalize_one_thread (struct thread_state *state)
773{ 783{
784 free_search_regs (&state->m_search_regs);
785 free_search_regs (&state->m_saved_search_regs);
774 sys_cond_destroy (&state->thread_condvar); 786 sys_cond_destroy (&state->thread_condvar);
775} 787}
776 788