Browse Source

Fix usage of freed object

develop
Anton Tarasenko 1 year ago
parent
commit
f15e704ce2
  1. 3
      sources/BaseAPI/API/Commands/CommandParser.uc

3
sources/BaseAPI/API/Commands/CommandParser.uc

@ -627,6 +627,7 @@ private final function HashTable AutoResolveAlias(MutableText textValue, Text al
_.memory.Free(immutableValue); _.memory.Free(immutableValue);
// Add "value" key only after we've checked for "$" prefix // Add "value" key only after we've checked for "$" prefix
if (!textValue.StartsWithS("$")) { if (!textValue.StartsWithS("$")) {
result.SetItem(P("value"), immutableValue);
return result; return result;
} }
if (aliasSourceName.Compare(P("weapon"))) { if (aliasSourceName.Compare(P("weapon"))) {
@ -641,7 +642,7 @@ private final function HashTable AutoResolveAlias(MutableText textValue, Text al
resolvedValue = _.alias.ResolveCustom(aliasSourceName, textValue, true); resolvedValue = _.alias.ResolveCustom(aliasSourceName, textValue, true);
} }
result.SetItem(P("value"), resolvedValue); result.SetItem(P("value"), resolvedValue);
_.memory.Free2(resolvedValue, immutableValue); _.memory.Free(resolvedValue);
return result; return result;
} }

Loading…
Cancel
Save