diff --git a/src/apps/showimage/ImageFileNavigator.cpp b/src/apps/showimage/ImageFileNavigator.cpp index b1e697744d..2c6afa3814 100644 --- a/src/apps/showimage/ImageFileNavigator.cpp +++ b/src/apps/showimage/ImageFileNavigator.cpp @@ -300,8 +300,10 @@ FolderNavigator::_BuildEntryList() while (true) { entry_ref* ref = new entry_ref(); status_t status = fFolder.GetNextRef(ref); - if (status != B_OK) + if (status != B_OK) { + delete ref; break; + } fEntries.AddItem(ref); }