Fix some memory leaks.
Add call to lldb.SBDebugger.Initialize() to lldb.py, so it automatically gets called when
the lldb Python module gets loaded.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116345 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index 64bdfcd..4a87ba0 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include <string>
+#include <vector>
#include <getopt.h>
#include <stdlib.h>
@@ -947,13 +948,10 @@
}
void
-CommandInterpreter::BuildAliasCommandArgs
-(
- CommandObject *alias_cmd_obj,
- const char *alias_name,
- Args &cmd_args,
- CommandReturnObject &result
-)
+CommandInterpreter::BuildAliasCommandArgs (CommandObject *alias_cmd_obj,
+ const char *alias_name,
+ Args &cmd_args,
+ CommandReturnObject &result)
{
OptionArgVectorSP option_arg_vector_sp = GetAliasOptions (alias_name);
@@ -970,10 +968,9 @@
OptionArgVector *option_arg_vector = option_arg_vector_sp.get();
int old_size = cmd_args.GetArgumentCount();
- int *used = (int *) malloc ((old_size + 1) * sizeof (int));
-
- memset (used, 0, (old_size + 1) * sizeof (int));
- used[0] = 1;
+ std::vector<bool> used (old_size + 1, false);
+
+ used[0] = true;
for (int i = 0; i < option_arg_vector->size(); ++i)
{
@@ -1002,7 +999,7 @@
else
{
new_args.AppendArgument (cmd_args.GetArgumentAtIndex (index));
- used[index] = 1;
+ used[index] = true;
}
}
}