From fb5a470cf84255dc0ef11b423864d1813869c6c6 Mon Sep 17 00:00:00 2001 From: Shao-Ce SUN Date: Wed, 6 Dec 2023 16:00:11 +0800 Subject: [PATCH] Temporary fix for memory leak when reading variables --------- Co-authored-by: Eugen-Andrei Gavriloaie --- src/MICmdCmdVar.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MICmdCmdVar.cpp b/src/MICmdCmdVar.cpp index 6712a48..a996058 100644 --- a/src/MICmdCmdVar.cpp +++ b/src/MICmdCmdVar.cpp @@ -304,7 +304,8 @@ void CMICmdCmdVarCreate::CompleteSBValue(lldb::SBValue &vrwValue) { // And update its children lldb::SBType valueType = vrwValue.GetType(); if (!valueType.IsPointerType() && !valueType.IsReferenceType()) { - const MIuint nChildren = vrwValue.GetNumChildren(); + const auto temp = vrwValue.GetNumChildren(); + const MIuint nChildren = temp > 64 ? 64 : temp; for (MIuint i = 0; i < nChildren; ++i) { lldb::SBValue member = vrwValue.GetChildAtIndex(i); if (member.IsValid()) @@ -597,7 +598,8 @@ bool CMICmdCmdVarUpdate::ExamineSBValueForChange(lldb::SBValue &vrwValue, return MIstatus::success; } - const MIuint nChildren = vrwValue.GetNumChildren(); + const auto temp = vrwValue.GetNumChildren(); + const MIuint nChildren = temp > 64 ? 64 : temp; for (MIuint i = 0; i < nChildren; ++i) { lldb::SBValue member = vrwValue.GetChildAtIndex(i); if (!member.IsValid())