iliaa           Tue Feb 13 23:39:14 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/main/streams       plain_wrapper.c 
  Log:
  
  Fixed a memory leak on highlight_file() with a non-existant file
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.52.2.6.2.14&r2=1.52.2.6.2.15&diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.52.2.6.2.14 
php-src/main/streams/plain_wrapper.c:1.52.2.6.2.15
--- php-src/main/streams/plain_wrapper.c:1.52.2.6.2.14  Mon Jan  1 09:36:12 2007
+++ php-src/main/streams/plain_wrapper.c        Tue Feb 13 23:39:14 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: plain_wrapper.c,v 1.52.2.6.2.14 2007/01/01 09:36:12 sebastian Exp $ */
+/* $Id: plain_wrapper.c,v 1.52.2.6.2.15 2007/02/13 23:39:14 iliaa Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -889,12 +889,12 @@
                                        *opened_path = realpath;
                                        realpath = NULL;
                                }
-                               if (realpath) {
-                                       efree(realpath);
-                               }
                                /* fall through */
 
                        case PHP_STREAM_PERSISTENT_FAILURE:
+                               if (realpath) {
+                                       efree(realpath);
+                               }
                                efree(persistent_id);;
                                return ret;
                }
@@ -933,6 +933,10 @@
 
                                r = do_fstat(self, 0);
                                if ((r == 0 && !S_ISREG(self->sb.st_mode))) {
+                                       if (opened_path) {
+                                               efree(*opened_path);
+                                               *opened_path = NULL;
+                                       }
                                        php_stream_close(ret);
                                        return NULL;
                                }

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

Reply via email to