Skip to content

Commit

Permalink
Destroy created file via reference release if necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
anevilyak committed Dec 6, 2012
1 parent 4a5bcf0 commit 8326ad4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/apps/debugger/dwarf/DwarfManager.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 8326ad4

Please sign in to comment.