diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2018-04-09 15:57:16 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2018-04-09 16:02:32 -0700 |
| commit | 7dd1d6afcc16342fecc70f667ff8ba13b0ad4372 (patch) | |
| tree | 3f95e2bdb96692eabd751da9cec837fd725bf095 /lib/utils/pyexec.c | |
| parent | e7b8b131860fb74e54c19d90d1e7630b92afd947 (diff) | |
Prevent a heap pointer from living on the stack longer than we need.
Diffstat (limited to 'lib/utils/pyexec.c')
| -rw-r--r-- | lib/utils/pyexec.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index f96deb9e1..718c6828c 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -90,6 +90,8 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input qstr source_name = lex->source_name; mp_parse_tree_t parse_tree = mp_parse(lex, input_kind); module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL); + // Clear the parse tree because it has a heap pointer we don't need anymore. + *((uint32_t volatile*) &parse_tree.chunk) = 0; #else mp_raise_msg(&mp_type_RuntimeError, "script compilation not supported"); #endif |
