diff --git a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp index d53f87093a..816fb8965e 100644 --- a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp @@ -183,66 +183,62 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, if (strcmp(member->Name(), "fHeader") == 0) { error = baseType->ResolveDataMemberLocation(member, *location, memberLocation); + BReference locationRef(memberLocation, true); if (error != B_OK) { TRACE_LOCALS( "BMessageValueNode::ResolvedLocationAndValue(): " "failed to resolve location of header member: %s\n", strerror(error)); - delete memberLocation; return error; } error = valueLoader->LoadValue(memberLocation, valueType, false, headerAddress); - delete memberLocation; if (error != B_OK) return error; } else if (strcmp(member->Name(), "what") == 0) { error = baseType->ResolveDataMemberLocation(member, *location, memberLocation); + BReference locationRef(memberLocation, true); if (error != B_OK) { TRACE_LOCALS( "BMessageValueNode::ResolvedLocationAndValue(): " "failed to resolve location of header member: %s\n", strerror(error)); - delete memberLocation; return error; } error = valueLoader->LoadValue(memberLocation, valueType, false, what); - delete memberLocation; if (error != B_OK) return error; } else if (strcmp(member->Name(), "fFields") == 0) { error = baseType->ResolveDataMemberLocation(member, *location, memberLocation); + BReference locationRef(memberLocation, true); if (error != B_OK) { TRACE_LOCALS( "BMessageValueNode::ResolvedLocationAndValue(): " "failed to resolve location of field member: %s\n", strerror(error)); - delete memberLocation; return error; } error = valueLoader->LoadValue(memberLocation, valueType, false, fieldAddress); - delete memberLocation; if (error != B_OK) return error; } else if (strcmp(member->Name(), "fData") == 0) { error = baseType->ResolveDataMemberLocation(member, *location, memberLocation); + BReference locationRef(memberLocation, true); if (error != B_OK) { TRACE_LOCALS( "BMessageValueNode::ResolvedLocationAndValue(): " "failed to resolve location of data member: %s\n", strerror(error)); - delete memberLocation; return error; } error = valueLoader->LoadValue(memberLocation, valueType, false, fDataLocation); - delete memberLocation; if (error != B_OK) return error; }