Skip to content

Commit a6c8c66

Browse files
sunshaoceshiretu
andauthored
Temporary fix for memory leak when reading variables (#115)
--------- Co-authored-by: Eugen-Andrei Gavriloaie <[email protected]>
1 parent af31036 commit a6c8c66

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/MICmdCmdVar.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ void CMICmdCmdVarCreate::CompleteSBValue(lldb::SBValue &vrwValue) {
304304
// And update its children
305305
lldb::SBType valueType = vrwValue.GetType();
306306
if (!valueType.IsPointerType() && !valueType.IsReferenceType()) {
307-
const MIuint nChildren = vrwValue.GetNumChildren();
307+
const auto temp = vrwValue.GetNumChildren();
308+
const MIuint nChildren = temp > 64 ? 64 : temp;
308309
for (MIuint i = 0; i < nChildren; ++i) {
309310
lldb::SBValue member = vrwValue.GetChildAtIndex(i);
310311
if (member.IsValid())
@@ -597,7 +598,8 @@ bool CMICmdCmdVarUpdate::ExamineSBValueForChange(lldb::SBValue &vrwValue,
597598
return MIstatus::success;
598599
}
599600

600-
const MIuint nChildren = vrwValue.GetNumChildren();
601+
const auto temp = vrwValue.GetNumChildren();
602+
const MIuint nChildren = temp > 64 ? 64 : temp;
601603
for (MIuint i = 0; i < nChildren; ++i) {
602604
lldb::SBValue member = vrwValue.GetChildAtIndex(i);
603605
if (!member.IsValid())

0 commit comments

Comments
 (0)