From 3eff55c2aadce885120c21e60b5db6cd482affa9 Mon Sep 17 00:00:00 2001 From: Wang Renxin Date: Mon, 5 Nov 2018 11:42:53 +0800 Subject: [PATCH] *fixed a crash bug when using an iterator in a conditional expression. --- HISTORY | 3 +++ core/my_basic.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/HISTORY b/HISTORY index e8569f9..703f761 100755 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,6 @@ +Nov. 5 2018 +Fixed a crash bug when using an iterator in a conditional expression + Jul. 30 2018 Fixed a crash bug with incomplete structures diff --git a/core/my_basic.c b/core/my_basic.c index 8765d9f..f85ea54 100755 --- a/core/my_basic.c +++ b/core/my_basic.c @@ -15827,9 +15827,22 @@ _exit: *l = ast; - if(val->type != _DT_UNKNOWN) + switch(val->type) { +#ifdef MB_ENABLE_COLLECTION_LIB + case _DT_LIST_IT: /* Fall through */ + case _DT_DICT_IT: + _destroy_object_capsule_only(val, 0); + + break; +#endif /* MB_ENABLE_COLLECTION_LIB */ + case _DT_UNKNOWN: /* Do nothing */ + break; + default: _destroy_object(val, 0); + break; + } + return result; }