Free $textMatches results only when done using it
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 29 Oct 2015 21:41:00 +0000 (14:41 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 29 Oct 2015 21:41:00 +0000 (14:41 -0700)
Change-Id: Ic534fa605ca9c771e7cbe7d3d243f1062fb2d022

includes/specials/SpecialSearch.php

index b100e49..2f47add 100644 (file)
@@ -384,8 +384,6 @@ class SpecialSearch extends SpecialPage {
                                $out->addHTML( $this->showInterwiki( $textMatches->getInterwikiResults(
                                                SearchResultSet::SECONDARY_RESULTS ), $term ) );
                        }
-
-                       $textMatches->free();
                }
 
                $hasOtherResults = $textMatches &&
@@ -416,6 +414,10 @@ class SpecialSearch extends SpecialPage {
                        }
                }
 
+               if ( $textMatches ) {
+                       $textMatches->free();
+               }
+
                $out->addHTML( '<div class="visualClear"></div>' );
 
                if ( $prevnext ) {
@@ -432,6 +434,7 @@ class SpecialSearch extends SpecialPage {
         * Produce wiki header for interwiki results
         * @param string $interwiki Interwiki name
         * @param SearchResultSet $interwikiResult The result set
+        * @return string
         */
        protected function interwikiHeader( $interwiki, $interwikiResult ) {
                // TODO: we need to figure out how to name wikis correctly