espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.76k stars 741 forks source link

fix LINUX crash on reset() with fixed variables size #2317

Closed fanoush closed 1 year ago

fanoush commented 1 year ago

LINUX defines JSVAR_MALLOC even for fixed variables and at reset() time jsvInit is called with size 0 so we need jsVarsSize filled with default value to malloc right size

alternatively we could avoid it by not defining JSVAR_MALLOC when variable size is fixed for LINUX here https://github.com/espruino/Espruino/blob/master/scripts/build_platform_config.py#L285 that seem to not trigger this bug

gfwilliams commented 1 year ago

Thanks! I think this is a good fix anyway