From 7f6caa088c7af5161c14b46cd3cfaa5830d1c378 Mon Sep 17 00:00:00 2001 From: Ryan Leavengood Date: Wed, 29 Dec 2010 03:54:07 +0000 Subject: [PATCH] CID 5772: Delete the unneeded (and leaked) ref on the loop end case. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40005 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/showimage/ImageFileNavigator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); }