From 8373bcd1693ce8f9a5072a0a181a2e63bc6993db Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 7 Jul 2011 08:10:15 +0200 Subject: [PATCH] Name::Index(): Fix initialization order Add the node listener directly after calling the base class Init(). Otherwise, on error, the we could try to remove the listener although it wasn't added in the first place. --- src/add-ons/kernel/file_systems/packagefs/NameIndex.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/file_systems/packagefs/NameIndex.cpp b/src/add-ons/kernel/file_systems/packagefs/NameIndex.cpp index ebc8a767ec..6172195e6d 100644 --- a/src/add-ons/kernel/file_systems/packagefs/NameIndex.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/NameIndex.cpp @@ -148,13 +148,12 @@ NameIndex::Init(Volume* volume) if (error != B_OK) return error; + fVolume->AddNodeListener(this, NULL); + fEntries = new(std::nothrow) EntryTree; if (fEntries == NULL) return B_NO_MEMORY; - fVolume = volume; - fVolume->AddNodeListener(this, NULL); - return B_OK; }