mirror of
https://github.com/chrim05/nds-console.git
synced 2025-06-18 21:55:34 -04:00
added frees for malloced data, except for NScript::Node, todo: add frees also for Node
This commit is contained in:
parent
1ab1a961b2
commit
bb8b8f49a9
@ -144,7 +144,10 @@ void NDSConsole::returnPrompt()
|
|||||||
|
|
||||||
// removing the old prompt buffer whether it's empty (returnPrompt worked because promptBuffer was set to another recent prompt)
|
// removing the old prompt buffer whether it's empty (returnPrompt worked because promptBuffer was set to another recent prompt)
|
||||||
if (recentPrompts[recentPrompts.size() - 1]->empty())
|
if (recentPrompts[recentPrompts.size() - 1]->empty())
|
||||||
|
{
|
||||||
|
delete recentPrompts[recentPrompts.size() - 1];
|
||||||
recentPrompts.pop_back();
|
recentPrompts.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
// reprinting the current prompt buffer without the cursor
|
// reprinting the current prompt buffer without the cursor
|
||||||
flushPromptBuffer(1, false);
|
flushPromptBuffer(1, false);
|
||||||
|
@ -39,6 +39,12 @@ class NDSConsole
|
|||||||
keyboardShow();
|
keyboardShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public: ~NDSConsole()
|
||||||
|
{
|
||||||
|
for (const auto& prompt : recentPrompts)
|
||||||
|
delete prompt;
|
||||||
|
}
|
||||||
|
|
||||||
public: void processVirtualKey(int key);
|
public: void processVirtualKey(int key);
|
||||||
|
|
||||||
public: void insertChar(char c);
|
public: void insertChar(char c);
|
||||||
|
@ -318,7 +318,13 @@ NScript::Node NScript::Evaluator::evaluateCallProcess(CallNode call, Position po
|
|||||||
|
|
||||||
processArgv[call.args.size()] = (char*)nullptr;
|
processArgv[call.args.size()] = (char*)nullptr;
|
||||||
|
|
||||||
return Node(NodeKind::Num, (NodeValue) { .num = float64(execv(processPath, processArgv)) }, pos);
|
auto result = Node(NodeKind::Num, (NodeValue) { .num = float64(execv(processPath, processArgv)) }, pos);
|
||||||
|
|
||||||
|
// freeing all args including processPath, which is the first arg
|
||||||
|
for (uint64_t i = 0; i < call.args.size(); i++)
|
||||||
|
delete [] processArgv[i];
|
||||||
|
|
||||||
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
NScript::Node NScript::Evaluator::evaluateCall(CallNode call, Position pos)
|
NScript::Node NScript::Evaluator::evaluateCall(CallNode call, Position pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user