Fix delete vs release issues in BMessageValueNode.

This commit is contained in:
Rene Gollent 2012-12-06 20:31:02 -05:00
parent dda60bf93a
commit f2ebf00cc2

View File

@ -183,66 +183,62 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
if (strcmp(member->Name(), "fHeader") == 0) {
error = baseType->ResolveDataMemberLocation(member,
*location, memberLocation);
BReference<ValueLocation> 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<ValueLocation> 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<ValueLocation> 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<ValueLocation> 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;
}