helly           Wed Feb  7 21:01:06 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/main       main.c php_open_temporary_file.c 
                        php_open_temporary_file.h 
  Log:
  - MFH Fix memleak with temp dir
  
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.29&r2=1.640.2.23.2.30&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.29 php-src/main/main.c:1.640.2.23.2.30
--- php-src/main/main.c:1.640.2.23.2.29 Mon Jan  8 03:39:09 2007
+++ php-src/main/main.c Wed Feb  7 21:01:06 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.640.2.23.2.29 2007/01/08 03:39:09 iliaa Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.30 2007/02/07 21:01:06 helly Exp $ */
 
 /* {{{ includes
  */
@@ -83,6 +83,7 @@
 #include "php_ticks.h"
 #include "php_logos.h"
 #include "php_streams.h"
+#include "php_open_temporary_file.h"
 
 #include "SAPI.h"
 #include "rfc1867.h"
@@ -1692,6 +1693,8 @@
        ts_free_id(core_globals_id);    
 #endif
 
+       php_shutdown_temporary_directory();
+
        module_initialized = 0;
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/main/php_open_temporary_file.c?r1=1.34.2.1.2.5&r2=1.34.2.1.2.6&diff_format=u
Index: php-src/main/php_open_temporary_file.c
diff -u php-src/main/php_open_temporary_file.c:1.34.2.1.2.5 
php-src/main/php_open_temporary_file.c:1.34.2.1.2.6
--- php-src/main/php_open_temporary_file.c:1.34.2.1.2.5 Mon Jan  1 09:36:11 2007
+++ php-src/main/php_open_temporary_file.c      Wed Feb  7 21:01:06 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_open_temporary_file.c,v 1.34.2.1.2.5 2007/01/01 09:36:11 sebastian 
Exp $ */
+/* $Id: php_open_temporary_file.c,v 1.34.2.1.2.6 2007/02/07 21:01:06 helly Exp 
$ */
 
 #include "php.h"
 
@@ -148,14 +148,22 @@
 }
 /* }}} */
 
+/* Cache the chosen temporary directory. */
+static char* temporary_directory;
+
+PHPAPI void php_shutdown_temporary_directory()
+{
+       if (temporary_directory) {
+               free(temporary_directory);
+               temporary_directory = NULL;
+       }
+}
+
 /*
  *  Determine where to place temporary files.
  */
 PHPAPI const char* php_get_temporary_directory(void)
 {
-       /* Cache the chosen temporary directory. */
-       static char* temporary_directory;
-
        /* Did we determine the temporary directory already? */
        if (temporary_directory) {
                return temporary_directory;
http://cvs.php.net/viewvc.cgi/php-src/main/php_open_temporary_file.h?r1=1.13.2.1.2.1&r2=1.13.2.1.2.2&diff_format=u
Index: php-src/main/php_open_temporary_file.h
diff -u php-src/main/php_open_temporary_file.h:1.13.2.1.2.1 
php-src/main/php_open_temporary_file.h:1.13.2.1.2.2
--- php-src/main/php_open_temporary_file.h:1.13.2.1.2.1 Mon Jan  1 09:36:11 2007
+++ php-src/main/php_open_temporary_file.h      Wed Feb  7 21:01:06 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_open_temporary_file.h,v 1.13.2.1.2.1 2007/01/01 09:36:11 sebastian 
Exp $ */
+/* $Id: php_open_temporary_file.h,v 1.13.2.1.2.2 2007/02/07 21:01:06 helly Exp 
$ */
 
 #ifndef PHP_OPEN_TEMPORARY_FILE_H
 #define PHP_OPEN_TEMPORARY_FILE_H
@@ -25,6 +25,7 @@
 PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char 
**opened_path_p TSRMLS_DC);
 PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char 
**opened_path_p TSRMLS_DC);
 PHPAPI const char *php_get_temporary_directory(void);
+PHPAPI void php_shutdown_temporary_directory();
 END_EXTERN_C()
 
 #endif /* PHP_OPEN_TEMPORARY_FILE_H */


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to