Changeset 4477

Show
Ignore:
Timestamp:
06/06/08 19:17:03 (13 months ago)
Author:
romanb
Message:

Fixed two memory-leaks caused by not freeing internally created query objects. Issue & patch provided by Stefan Klug through the dev-mailinglist.

Location:
branches/0.11
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Connection.php

    r4372 r4477  
    874874    { 
    875875        $parser = new Doctrine_Query($this); 
    876  
    877         return $parser->query($query, $params, $hydrationMode); 
     876        $res = $parser->query($query, $params, $hydrationMode); 
     877        $parser->free(); 
     878 
     879        return $res; 
    878880    } 
    879881 
  • branches/0.11/lib/Doctrine/Table.php

    r4449 r4477  
    12151215 
    12161216        $id = is_array($id) ? array_values($id) : array($id); 
    1217  
    1218         return $this->createQuery() 
    1219             ->where(implode(' = ? AND ', (array) $this->getIdentifier()) . ' = ?', $id) 
    1220             ->limit(1) 
    1221             ->fetchOne(array(), $hydrationMode); 
     1217         
     1218        $q = $this->createQuery(); 
     1219        $q->where(implode(' = ? AND ', (array) $this->getIdentifier()) . ' = ?', $id) 
     1220                ->limit(1); 
     1221        $res = $q->fetchOne(array(), $hydrationMode); 
     1222        $q->free(); 
     1223         
     1224        return $res; 
    12221225    } 
    12231226 
  • branches/0.11/tests/run.php

    r4474 r4477  
    4646$tickets->addTestCase(new Doctrine_Ticket_941_TestCase()); 
    4747$tickets->addTestCase(new Doctrine_Ticket_930_TestCase()); 
    48 $tickets->addTestCase(new Doctrine_Ticket_NewTicket_TestCase()); 
    4948 
    5049// Only uncomment the following ticket if you want to check free() performance!