From: hrichter at udec dot cl Operating system: Linux 2.6.9-5.EL PHP version: 5.2.5 PHP Bug Type: Unknown/Other Function Bug description: Memory leak in addcslashes
Description: ------------ The function addcslashes doesn't free memory when its first argument is longer than 4 CONFIGURE LINE: ./configure --prefix=/opt/lampp --with-apxs2=/opt/lampp/bin/apxs --with-config-file-path=/opt/lampp/etc --with-mysql=/opt/lampp --enable-inline-optimization --disable-debug --enable-bcmath --enable-calendar --enable-ctype --enable-dbase --enable-discard-path --enable-exif --enable-filepro --enable-force-cgi-redirect --enable-ftp --enable-gd-imgstrttf --enable-gd-native-ttf --with-ttf --enable-magic-quotes --enable-memory-limit --enable-shmop --enable-sigchild --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-wddx --enable-yp --with-ftp --with-gdbm=/opt/lampp --with-jpeg-dir=/opt/lampp --with-png-dir=/opt/lampp --with-freetype-dir=/opt/lampp --without-xpm --with-zlib=yes --with-zlib-dir=/opt/lampp --with-openssl=/opt/lampp --with-expat-dir=/opt/lampp --enable-xslt=/opt/lampp --with-xsl=/opt/lampp --with-dom=/opt/lampp --with-ldap=/opt/lampp --with-ncurses=/opt/lampp --with-gd --with-imap-dir=/opt/lampp --with-imap-ssl --with-imap=/opt/lampp --with-gettext=/opt/lampp --with-mssql=/opt/lampp --with-sybase=/opt/lampp --with-interbase=shared,/opt/interbase --with-mysql-sock=/opt/lampp/var/mysql/mysql.sock --with-oci8=shared,instantclient,/opt/lampp/lib/instantclient --with-mcrypt=/opt/lampp --with-mhash=/opt/lampp --enable-sockets --enable-mbstring=all --with-curl=/opt/lampp --enable-mbregex --enable-zend-multibyte --enable-exif --with-bz2=/opt/lampp --with-sqlite=shared,/opt/lampp --with-libxml-dir=/opt/lampp --enable-soap --enable-pcntl --with-mysqli=/opt/lampp/bin/mysql_config --with-mime-magic --with-pgsql=shared,/opt/lampp/postgresql --with-iconv --enable-dio --with-pdo-mysql=/opt/lampp --with-pdo-pgsql=/opt/lampp/postgresql --with-pdo-sqlite --with-ming=shared,/opt/lampp Reproduce code: --------------- for($i=0 ; $i<5000 ; ++$i){ addcslashes("12345","'") ; echo memory_get_usage(),"<br>\n" ; } Expected result: ---------------- The memory usage should be the same in every iteration. Actual result: -------------- The memory usage keeps growing and growing up to a certain maximum which depends on the length of the first argument of addcslashes. -- Edit bug report at http://bugs.php.net/?id=44875&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44875&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44875&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44875&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44875&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44875&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44875&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44875&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44875&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44875&r=support Expected behavior: http://bugs.php.net/fix.php?id=44875&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44875&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44875&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44875&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44875&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44875&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44875&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44875&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44875&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44875&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44875&r=mysqlcfg