Skip to content

Commit

Permalink
fix(lang): fix memory leak bug in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Water-Melon committed Apr 28, 2024
1 parent 7a08850 commit a652ad9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mln_lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@ MLN_FUNC(, mln_lang_t *, mln_lang_new, \
MLN_FUNC_VOID(, void, mln_lang_free, (mln_lang_t *lang), (lang), {
if (lang == NULL) return;

mln_alloc_t *pool = lang->pool;

pthread_mutex_lock(&lang->lock);

if (lang->wait) {
Expand Down Expand Up @@ -623,7 +625,8 @@ MLN_FUNC_VOID(, void, mln_lang_free, (mln_lang_t *lang), (lang), {
pthread_mutex_unlock(&lang->lock);
pthread_mutex_destroy(&lang->lock);

mln_alloc_destroy(lang->pool);
mln_alloc_free(lang);
mln_alloc_destroy(pool);
})

MLN_FUNC_VOID(static, void, mln_lang_run_handler, \
Expand Down

0 comments on commit a652ad9

Please sign in to comment.