From 2db807870b8575e90030bce5a8bf056e6aa48f3a Mon Sep 17 00:00:00 2001 From: Avril Date: Thu, 18 Mar 2021 20:49:19 +0000 Subject: [PATCH] fix memory leak with yield return values --- src/state.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/state.cpp b/src/state.cpp index 65a7302..61f3f82 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -74,6 +74,11 @@ void _sm_pop_stack(sm_state* state) auto last = unbox(state->current); state->current = last.prev; + if(last.rval) + { + sm_free_user(last.rval); + unbox(last.rval); + } _sm_free_all_pages(last.user.next); _sm_free_page(&last.user); }