Fix delete vs release issues in BMessageValueNode.

This commit is contained in:
Rene Gollent
2012-12-07 17:36:28 -05:00
parent dda60bf93a
commit f2ebf00cc2
@@ -183,66 +183,62 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
if (strcmp(member->Name(), "fHeader") == 0) { if (strcmp(member->Name(), "fHeader") == 0) {
error = baseType->ResolveDataMemberLocation(member, error = baseType->ResolveDataMemberLocation(member,
*location, memberLocation); *location, memberLocation);
BReference<ValueLocation> locationRef(memberLocation, true);
if (error != B_OK) { if (error != B_OK) {
TRACE_LOCALS( TRACE_LOCALS(
"BMessageValueNode::ResolvedLocationAndValue(): " "BMessageValueNode::ResolvedLocationAndValue(): "
"failed to resolve location of header member: %s\n", "failed to resolve location of header member: %s\n",
strerror(error)); strerror(error));
delete memberLocation;
return error; return error;
} }
error = valueLoader->LoadValue(memberLocation, valueType, error = valueLoader->LoadValue(memberLocation, valueType,
false, headerAddress); false, headerAddress);
delete memberLocation;
if (error != B_OK) if (error != B_OK)
return error; return error;
} else if (strcmp(member->Name(), "what") == 0) { } else if (strcmp(member->Name(), "what") == 0) {
error = baseType->ResolveDataMemberLocation(member, error = baseType->ResolveDataMemberLocation(member,
*location, memberLocation); *location, memberLocation);
BReference<ValueLocation> locationRef(memberLocation, true);
if (error != B_OK) { if (error != B_OK) {
TRACE_LOCALS( TRACE_LOCALS(
"BMessageValueNode::ResolvedLocationAndValue(): " "BMessageValueNode::ResolvedLocationAndValue(): "
"failed to resolve location of header member: %s\n", "failed to resolve location of header member: %s\n",
strerror(error)); strerror(error));
delete memberLocation;
return error; return error;
} }
error = valueLoader->LoadValue(memberLocation, valueType, error = valueLoader->LoadValue(memberLocation, valueType,
false, what); false, what);
delete memberLocation;
if (error != B_OK) if (error != B_OK)
return error; return error;
} else if (strcmp(member->Name(), "fFields") == 0) { } else if (strcmp(member->Name(), "fFields") == 0) {
error = baseType->ResolveDataMemberLocation(member, error = baseType->ResolveDataMemberLocation(member,
*location, memberLocation); *location, memberLocation);
BReference<ValueLocation> locationRef(memberLocation, true);
if (error != B_OK) { if (error != B_OK) {
TRACE_LOCALS( TRACE_LOCALS(
"BMessageValueNode::ResolvedLocationAndValue(): " "BMessageValueNode::ResolvedLocationAndValue(): "
"failed to resolve location of field member: %s\n", "failed to resolve location of field member: %s\n",
strerror(error)); strerror(error));
delete memberLocation;
return error; return error;
} }
error = valueLoader->LoadValue(memberLocation, valueType, error = valueLoader->LoadValue(memberLocation, valueType,
false, fieldAddress); false, fieldAddress);
delete memberLocation;
if (error != B_OK) if (error != B_OK)
return error; return error;
} else if (strcmp(member->Name(), "fData") == 0) { } else if (strcmp(member->Name(), "fData") == 0) {
error = baseType->ResolveDataMemberLocation(member, error = baseType->ResolveDataMemberLocation(member,
*location, memberLocation); *location, memberLocation);
BReference<ValueLocation> locationRef(memberLocation, true);
if (error != B_OK) { if (error != B_OK) {
TRACE_LOCALS( TRACE_LOCALS(
"BMessageValueNode::ResolvedLocationAndValue(): " "BMessageValueNode::ResolvedLocationAndValue(): "
"failed to resolve location of data member: %s\n", "failed to resolve location of data member: %s\n",
strerror(error)); strerror(error));
delete memberLocation;
return error; return error;
} }
error = valueLoader->LoadValue(memberLocation, valueType, error = valueLoader->LoadValue(memberLocation, valueType,
false, fDataLocation); false, fDataLocation);
delete memberLocation;
if (error != B_OK) if (error != B_OK)
return error; return error;
} }