felipe Wed, 14 Sep 2011 01:45:57 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=316696
Log:
- Fixed memory leak when calling SessionHandler::open() several times
Changed paths:
U php/php-src/branches/PHP_5_4/ext/session/mod_files.c
A
php/php-src/branches/PHP_5_4/ext/session/tests/sessionhandler_open_001.phpt
U php/php-src/trunk/ext/session/mod_files.c
A php/php-src/trunk/ext/session/tests/sessionhandler_open_001.phpt
Modified: php/php-src/branches/PHP_5_4/ext/session/mod_files.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/session/mod_files.c 2011-09-14
01:42:25 UTC (rev 316695)
+++ php/php-src/branches/PHP_5_4/ext/session/mod_files.c 2011-09-14
01:45:57 UTC (rev 316696)
@@ -311,6 +311,9 @@
data->basedir_len = strlen(save_path);
data->basedir = estrndup(save_path, data->basedir_len);
+ if (PS_GET_MOD_DATA()) {
+ ps_close_files(mod_data TSRMLS_CC);
+ }
PS_SET_MOD_DATA(data);
return SUCCESS;
Added:
php/php-src/branches/PHP_5_4/ext/session/tests/sessionhandler_open_001.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/session/tests/sessionhandler_open_001.phpt
(rev 0)
+++ php/php-src/branches/PHP_5_4/ext/session/tests/sessionhandler_open_001.phpt
2011-09-14 01:45:57 UTC (rev 316696)
@@ -0,0 +1,19 @@
+--TEST--
+Testing repated SessionHandler::open() calls
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ini_set('session.save_handler', 'files');
+$x = new SessionHandler;
+$x->open('','');
+$x->open('','');
+$x->open('','');
+$x->open('','');
+
+print "Done!\n";
+
+?>
+--EXPECTF--
+Done!
Modified: php/php-src/trunk/ext/session/mod_files.c
===================================================================
--- php/php-src/trunk/ext/session/mod_files.c 2011-09-14 01:42:25 UTC (rev
316695)
+++ php/php-src/trunk/ext/session/mod_files.c 2011-09-14 01:45:57 UTC (rev
316696)
@@ -311,6 +311,9 @@
data->basedir_len = strlen(save_path);
data->basedir = estrndup(save_path, data->basedir_len);
+ if (PS_GET_MOD_DATA()) {
+ ps_close_files(mod_data TSRMLS_CC);
+ }
PS_SET_MOD_DATA(data);
return SUCCESS;
Added: php/php-src/trunk/ext/session/tests/sessionhandler_open_001.phpt
===================================================================
--- php/php-src/trunk/ext/session/tests/sessionhandler_open_001.phpt
(rev 0)
+++ php/php-src/trunk/ext/session/tests/sessionhandler_open_001.phpt
2011-09-14 01:45:57 UTC (rev 316696)
@@ -0,0 +1,19 @@
+--TEST--
+Testing repated SessionHandler::open() calls
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ini_set('session.save_handler', 'files');
+$x = new SessionHandler;
+$x->open('','');
+$x->open('','');
+$x->open('','');
+$x->open('','');
+
+print "Done!\n";
+
+?>
+--EXPECTF--
+Done!
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php