Skip to content

Commit 2c30516

Browse files
committed
Fix memory leak if an error happens while parsing function arguments - eg print(1,2,3,JSON.parse("!%^$^"),123)
1 parent 21eff4f commit 2c30516

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
Bangle.js2: Switched to proprietary heart rate algorithm (from our Open Source version). It just works better.
1919
JIT: Implemented do { a } while (b)
2020
Ensure that for(in), Object.keys and Object.getOwnPropertyNames return array indices as strings (not numbers)
21+
Fix memory leak when an error happens while parsing function arguments - eg `print(1,2,3,JSON.parse("!%^$^"),123)`
2122

2223
2v17 : Bangle.js: When reading file info from a filename table, do it in blocks of 8 (20% faster file search)
2324
Bangle.js2: Increase flash buffer size from 16->32 bytes (5% performance increase)

src/jsparse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ NO_INLINE JsVar *jspeFunctionCall(JsVar *function, JsVar *functionName, JsVar *t
611611
if (lex->tk!=')') JSP_MATCH_WITH_CLEANUP_AND_RETURN(',',jsvUnLockMany((unsigned)argCount, argPtr);jsvUnLock(thisVar);, 0);
612612
}
613613

614-
JSP_MATCH(')');
614+
JSP_MATCH_WITH_CLEANUP_AND_RETURN(')',jsvUnLockMany((unsigned)argCount, argPtr);jsvUnLock(thisVar);, 0);
615615
allocatedArgCount = argCount;
616616
}
617617

0 commit comments

Comments
 (0)