title: Is there any mistake in this code to make memory leak?
body: <p>I tried more than a time but every time gives the same error.</p>
  
  <pre><code>Fatal error: Out of memory (allocated 507510784) (tried to allocate 16384 bytes) in ..(location)..\accounts.php on line 51
  </code></pre>
  
  <p>The function</p>
  
  <pre><code>public function getUser($userBase, $allowID = true, $allowUName = true, $allowEmail = true, $allowHash = true) {
              // If nothing allowed!
              if ($allowID == false &amp;&amp; $allowUName == false &amp;&amp; $allowEmail == false &amp;&amp; $allowHash == false) {
                  return NULL;
              }
              if ( $allowID == true ) {
                  // User ID
                  $result = $this-&gt;conn-&gt;query( "SELECT * FROM `accounts` WHERE `id` = {$userBase}" );
                  if ( $result &amp;&amp; $result-&gt;num_rows &gt; 0 ) {
                      return new user( $this-&gt;conn, $userBase );
                  }
              }
              if ( $allowUName == true ) {
                  // User Name
                  $result = $this-&gt;conn-&gt;query( "SELECT * FROM `accounts` WHERE `username` = '{$userBase}'" );
                  if ( $result &amp;&amp; $result-&gt;num_rows &gt; 0 ) {
                      return new user( $this-&gt;conn, $userBase );
                  }
              }
              if ( $allowEmail == true ) {
                  // Email
                  $result = $this-&gt;conn-&gt;query( "SELECT * FROM `accounts` WHERE `email` = '{$userBase}'" );
                  if ( $result &amp;&amp; $result-&gt;num_rows &gt; 0 ) {
                      return new user( $this-&gt;conn, $userBase );
                  }
              }
              if ( $allowHash == true ) {
                  $result = $this-&gt;conn-&gt;query( "SELECT * FROM `accounts` WHERE `hash` = '{$userBase}'" );
                  if ( $result &amp;&amp; $result-&gt;num_rows &gt; 0 ) {
                      return new user( $this-&gt;conn, $userBase );
                  }
              }
              return NULL;
          }
  </code></pre>
  
  <p>And this is how I do call it.</p>
  
  <pre><code>return this-&gt;getUser($uname, false, true, true, false);
  </code></pre>
  
  <p>I don't know the reason why it uses this huge memory.</p>