Skip to content

Commit b64e91b

Browse files
Remove incorrect ScriptException::Clear function
This function doesn't free the references, and causes us to leak the excepinfo strings. Instead use Free in the two places where we do call this, and remove the function to prevent future use.
1 parent 199801c commit b64e91b

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

lib/Parser/screrror.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,6 @@ CompileScriptException::~CompileScriptException()
227227
SysFreeString(bstrLine);
228228
}
229229

230-
void CompileScriptException::Clear()
231-
{
232-
memset(this, 0, sizeof(*this));
233-
}
234-
235230
void CompileScriptException::Free()
236231
{
237232
ScriptException::Free();
@@ -246,7 +241,7 @@ void CompileScriptException::Free()
246241
HRESULT CompileScriptException::ProcessError(IScanner * pScan, HRESULT hr, ParseNode * pnodeBase)
247242
{
248243
// fill in the ScriptException structure
249-
Clear();
244+
Free();
250245
ei.scode = GetScode(MapHr(hr));
251246

252247
// get the error string

lib/Parser/screrror.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class CompileScriptException : public ScriptException
6363
~CompileScriptException();
6464

6565
public:
66-
void Clear();
6766
void Free();
6867
void GetError(HRESULT *phr, EXCEPINFO *pei)
6968
{

lib/Runtime/Base/ScriptContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ namespace Js
19501950
{
19511951
Assert((loadScriptFlag & LoadScriptFlag_disableAsmJs) != LoadScriptFlag_disableAsmJs);
19521952

1953-
pse->Clear();
1953+
pse->Free();
19541954

19551955
loadScriptFlag = (LoadScriptFlag)(loadScriptFlag | LoadScriptFlag_disableAsmJs);
19561956
return LoadScript(script, cb, pSrcInfo, pse, ppSourceInfo,

0 commit comments

Comments
 (0)