DirMenu.cpp: fix memory leak.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>

Fixes #13118.
This commit is contained in:
Murai Takashi 2016-12-20 05:49:19 +09:00 committed by Adrien Destugues
parent 76c469dbcf
commit 4ad2ad6d84
1 changed files with 4 additions and 2 deletions

View File

@ -95,10 +95,12 @@ BDirMenu::Populate(const BEntry* startEntry, BWindow* originatingWindow,
Model model(startEntry);
ThrowOnInitCheckError(&model);
ModelMenuItem* menu = new ModelMenuItem(&model, this, true, true);
ModelMenuItem* menu = NULL;
if (fMenuBar)
if (fMenuBar) {
menu = new ModelMenuItem(&model, this, true, true);
fMenuBar->AddItem(menu);
}
BEntry entry(*startEntry);