Fix issue with registered variables becoming corrupted when string value was accessed.

This commit is contained in:
James Urquhart 2015-05-16 14:50:20 +01:00
parent 3a218217f4
commit 15169eab9f
3 changed files with 43 additions and 24 deletions

View file

@ -186,19 +186,20 @@ public:
fval = 0;
sval = typeValueEmpty;
bufferLen = 0;
type = TypeInternalString;
type = TypeInternalString;
}
void cleanup()
{
if (type <= TypeInternalString &&
sval != typeValueEmpty && type != TypeInternalStackString && type != TypeInternalStringStackPtr)
if (bufferLen > 0)
{
dFree(sval);
bufferLen = 0;
}
sval = typeValueEmpty;
type = ConsoleValue::TypeInternalString;
ival = 0;
fval = 0;
bufferLen = 0;
}
};