Fix leaking of type references.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42381 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2011-07-05 00:57:29 +00:00
parent b6c5f46896
commit 90753bf805
1 changed files with 5 additions and 0 deletions

View File

@ -319,11 +319,14 @@ BMessageValueNode::CreateChildren()
type_code type;
int32 count;
Type* fieldType = NULL;
BReference<Type> typeRef;
for (int32 i = 0; fMessage.GetInfo(B_ANY_TYPE, i, &name, &type,
&count) == B_OK; i++) {
fieldType = NULL;
_GetTypeForTypeCode(type, fieldType);
if (fieldType != NULL)
typeRef.SetTo(fieldType, true);
BMessageFieldNodeChild* node = new(std::nothrow)
BMessageFieldNodeChild(this,
@ -603,6 +606,8 @@ BMessageValueNode::BMessageFieldNode::CreateChildren()
status_t error = fParent->_GetTypeForTypeCode(fFieldType, type);
if (error != B_OK)
return error;
BReference<Type> typeRef(type, true);
for (int32 i = 0; i < fFieldCount; i++) {
BMessageFieldNodeChild* child = new(std::nothrow)
BMessageFieldNodeChild(fParent, type, fName, fFieldType, fFieldCount, i);