From: Paul Eggert Date: Thu, 28 Mar 2019 03:58:34 +0000 (-0700) Subject: Fix search_regs memory leak when thread destroyed X-Git-Tag: emacs-27.0.90~3310 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=361e88986f3580a7433a23eec1cf01408e5e3627;p=emacs.git Fix search_regs memory leak when thread destroyed * src/thread.c (free_search_regs): New function. (finalize_one_thread): Use it. --- 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) return NULL; } +static void +free_search_regs (struct re_registers *regs) +{ + if (regs->num_regs != 0) + { + xfree (regs->start); + xfree (regs->end); + } +} + void finalize_one_thread (struct thread_state *state) { + free_search_regs (&state->m_search_regs); + free_search_regs (&state->m_saved_search_regs); sys_cond_destroy (&state->thread_condvar); }