svn: /php/php-src/ branches/PHP_5_3/sapi/cgi/cgi_main.c branches/PHP_5_4/sapi/cgi/cgi_main.c trunk/sapi/cgi/cgi_main.c
| From: | Dmitry Stogov | Date: | Thu, 11 Aug 2011 06:38:42 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/sapi/cgi/cgi_main.c branches/PHP_5_4/sapi/cgi/cgi_main.c trunk/sapi/cgi/cgi_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-65822@lists.php.net to get a copy of this message | ||
dmitry Thu, 11 Aug 2011 06:38:42 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=314773
Log:
Fixed possible memory leak
Changed paths:
U php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c
U php/php-src/branches/PHP_5_4/sapi/cgi/cgi_main.c
U php/php-src/trunk/sapi/cgi/cgi_main.c
Modified: php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c 2011-08-11 03:11:56 UTC (rev 314772)
+++ php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c 2011-08-11 06:38:42 UTC (rev 314773)
@@ -725,7 +725,7 @@
/* Check whether cache entry has expired and rescan if it is */
if (request_time > entry->expires) {
- char * real_path;
+ char *real_path = NULL;
int real_path_len;
char *s1, *s2;
int s_len;
@@ -774,6 +774,9 @@
php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config TSRMLS_CC);
}
+ if (real_path) {
+ free(real_path);
+ }
entry->expires = request_time + PG(user_ini_cache_ttl);
}
Modified: php/php-src/branches/PHP_5_4/sapi/cgi/cgi_main.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cgi/cgi_main.c 2011-08-11 03:11:56 UTC (rev 314772)
+++ php/php-src/branches/PHP_5_4/sapi/cgi/cgi_main.c 2011-08-11 06:38:42 UTC (rev 314773)
@@ -761,7 +761,7 @@
/* Check whether cache entry has expired and rescan if it is */
if (request_time > entry->expires) {
- char * real_path;
+ char *real_path = NULL;
int real_path_len;
char *s1, *s2;
int s_len;
@@ -809,6 +809,9 @@
php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config TSRMLS_CC);
}
+ if (real_path) {
+ free(real_path);
+ }
entry->expires = request_time + PG(user_ini_cache_ttl);
}
Modified: php/php-src/trunk/sapi/cgi/cgi_main.c
===================================================================
--- php/php-src/trunk/sapi/cgi/cgi_main.c 2011-08-11 03:11:56 UTC (rev 314772)
+++ php/php-src/trunk/sapi/cgi/cgi_main.c 2011-08-11 06:38:42 UTC (rev 314773)
@@ -761,7 +761,7 @@
/* Check whether cache entry has expired and rescan if it is */
if (request_time > entry->expires) {
- char * real_path;
+ char *real_path = NULL;
int real_path_len;
char *s1, *s2;
int s_len;
@@ -809,6 +809,9 @@
php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config TSRMLS_CC);
}
+ if (real_path) {
+ free(real_path);
+ }
entry->expires = request_time + PG(user_ini_cache_ttl);
}