Fix: memory leak when parsing (strgen) commands by moving to C++ containers

This commit is contained in:
Rubidium
2023-04-30 19:17:42 +02:00
committed by rubidium42
parent 4f94655cc2
commit 802d6cb509
3 changed files with 35 additions and 41 deletions

View File

@@ -270,10 +270,9 @@ static void ExtractStringParams(const StringData &data, StringParamsList &params
if (ls != nullptr) {
StringParams &param = params.emplace_back();
ParsedCommandStruct pcs;
ExtractCommandString(&pcs, ls->english.c_str(), false);
ParsedCommandStruct pcs = ExtractCommandString(ls->english.c_str(), false);
for (const CmdStruct *cs : pcs.cmd) {
for (const CmdStruct *cs : pcs.consuming_commands) {
if (cs == nullptr) break;
param.emplace_back(GetParamType(cs), cs->consumes);
}