[EFL] [WK2] Don't call eina_iterator_free() if iterator is NULL
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 10:04:12 +0000 (10:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 10:04:12 +0000 (10:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90076

Patch by Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> on 2012-07-03
Reviewed by Kenneth Rohde Christiansen.

Add a null check to prevent calling eina_iterator_free() when
iterator is NULL.

No new tests. This patch doesn't change behavior.

* platform/efl/FileSystemEfl.cpp:
(WebCore::listDirectory): Early return when iterator is NULL.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121752 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/efl/FileSystemEfl.cpp

index 30e4406..ee798d2 100644 (file)
@@ -1,3 +1,18 @@
+2012-07-03  Sudarsana Nagineni  <sudarsana.nagineni@linux.intel.com>
+
+        [EFL] [WK2] Don't call eina_iterator_free() if iterator is NULL
+        https://bugs.webkit.org/show_bug.cgi?id=90076
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add a null check to prevent calling eina_iterator_free() when
+        iterator is NULL.
+
+        No new tests. This patch doesn't change behavior.
+
+        * platform/efl/FileSystemEfl.cpp:
+        (WebCore::listDirectory): Early return when iterator is NULL.
+
 2012-07-03  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: [Elements] Text formatting is not retained when editing <script> or <style> contents as text
index 0caae89..4078822 100644 (file)
@@ -91,6 +91,12 @@ Vector<String> listDirectory(const String& path, const String& filter)
     const char *f_name;
 
     Eina_Iterator* it = eina_file_ls(path.utf8().data());
+    // FIXME: Early return if the iterator is null to avoid error messages from eina_iterator_free().
+    // This check can be removed once the magic check on _free() removed in Eina.
+    // http://www.mail-archive.com/enlightenment-devel@lists.sourceforge.net/msg42944.html
+    if (!it)
+        return matchingEntries;
+
     EINA_ITERATOR_FOREACH(it, f_name) {
         if (!fnmatch(cfilter.data(), f_name, 0))
             matchingEntries.append(String::fromUTF8(f_name));