Destroy created file via reference release if necessary.

This commit is contained in:
Rene Gollent
2012-12-05 20:07:02 -05:00
parent 4a5bcf0f7a
commit 8326ad45bb
+2 -1
View File
@@ -41,13 +41,14 @@ DwarfManager::LoadFile(const char* fileName, DwarfFile*& _file)
if (file == NULL)
return B_NO_MEMORY;
BReference<DwarfFile> fileReference(file, true);
status_t error = file->Load(fileName);
if (error != B_OK) {
delete file;
return error;
}
fFiles.Add(file);
fileReference.Detach();
// we keep the initial reference for ourselves
file->AcquireReference();