iliaa           Mon Dec 22 16:03:55 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/standard       file.c 
  Log:
  Fixed memory leak.
  
  
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.46 php-src/ext/standard/file.c:1.279.2.47
--- php-src/ext/standard/file.c:1.279.2.46      Mon Dec 15 13:53:25 2003
+++ php-src/ext/standard/file.c Mon Dec 22 16:03:54 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.279.2.46 2003/12/15 18:53:25 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.47 2003/12/22 21:03:54 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -2190,7 +2190,7 @@
 
        zval **fd, **bytes, **p_delim, **p_enclosure;
        int len, buf_len;
-       char *buf, *p, *s, *e, *re;
+       char *buf, *p, *s, *e, *re, *buf2=NULL;
        php_stream *stream;
 
        switch(ZEND_NUM_ARGS()) {
@@ -2289,7 +2289,7 @@
                        s = p + 1;
                }
        } else {
-               char *p2=NULL, *buf2=NULL;
+               char *p2=NULL;
                int buf2_len=0;
 enclosure:
                /* handle complete fields before the enclosure */
@@ -2351,9 +2351,7 @@
                        }
 enclosure_done:
                        CSV_ADD_ENTRY(buf2, buf2_len, 0);
-                       if (buf2) {
-                               efree(buf2);
-                       }
+
                        goto done;
                }
        }
@@ -2362,6 +2360,9 @@
                CSV_ADD_ENTRY(s, e, s);
        }
 done:
+       if (buf2) {
+               efree(buf2);
+       }
        efree(buf);
 }
 /* }}} */

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

Reply via email to