memory leak in mathexpr.cpp
Brought to you by:
allhilbert,
frm
I've compiled GLplot under MS VisualC++ 7.0. In order to achieve this, I've downloaded the original version of third-party mathexpr library, and found a memory leak in mathexpr.cpp there:
s=new char[n];
// HACK: mlkz memory leak when op == Num || op == Var
switch(op){
case Num:return ValToStr(ValC);
case Var:return CopyStr(pvar->name);
............
This error can be found in your patched mathexpr.cpp as well. Here is the solution:
s=new char[n]; // HACK: mlkz memory leak when op == Num || op == Var
switch(op){
case Num:
{
delete[] s; // PATCH: mlkz
return ValToStr(ValC);
}
case Var:
{
delete[] s; // PATCH: mlkz
return CopyStr(pvar->name);
}