tony2001                Thu May 12 12:27:23 2005 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/sockets        sockets.c 
    /php-src    NEWS 
  Log:
  MFH: fix #33019 (socket errors cause memory leaks in php_strerror())
  patch by jwozniak23 at poczta dot onet dot pl
  
  
http://cvs.php.net/diff.php/php-src/ext/sockets/sockets.c?r1=1.125.2.28&r2=1.125.2.29&ty=u
Index: php-src/ext/sockets/sockets.c
diff -u php-src/ext/sockets/sockets.c:1.125.2.28 
php-src/ext/sockets/sockets.c:1.125.2.29
--- php-src/ext/sockets/sockets.c:1.125.2.28    Mon Feb 14 18:46:07 2005
+++ php-src/ext/sockets/sockets.c       Thu May 12 12:27:21 2005
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: sockets.c,v 1.125.2.28 2005/02/14 23:46:07 sniper Exp $ */
+/* $Id: sockets.c,v 1.125.2.29 2005/05/12 16:27:21 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -354,6 +354,10 @@
                buf = hstrerror(error);
 #else
                {
+                       if (SOCKETS_G(strerror_buf)) {
+                               efree(SOCKETS_G(strerror_buf));
+                       }
+
                        spprintf(&(SOCKETS_G(strerror_buf)), 0, "Host lookup 
error %d", error);
                        buf = SOCKETS_G(strerror_buf);
                }
@@ -368,6 +372,11 @@
 
                if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
                                  NULL, error, MAKELANGID(LANG_NEUTRAL, 
SUBLANG_DEFAULT), (LPTSTR) &tmp, 0, NULL)) {
+                       
+                       if (SOCKETS_G(strerror_buf)) {
+                               efree(SOCKETS_G(strerror_buf));
+                       }
+
                        SOCKETS_G(strerror_buf) = estrdup(tmp);
                        LocalFree(tmp);
                
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.901&r2=1.1247.2.902&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.901 php-src/NEWS:1.1247.2.902
--- php-src/NEWS:1.1247.2.901   Tue May 10 19:15:05 2005
+++ php-src/NEWS        Thu May 12 12:27:22 2005
@@ -7,6 +7,8 @@
   them sort based on the current locale. (Derick)
 - Changed sha1_file() and md5_file() functions to use streams instead of 
   low level IO. (Uwe)
+- Fixed bug #33019 (socket errors cause memory leaks in php_strerror()). 
+  (jwozniak23 at poczta dot onet dot pl, Tony).
 - Fixed bug #32974 (pcntl calls malloc() from a signal handler). (Wez)
 - Fixed bug #32936 (http redirects URLs are not checked for control chars). 
(Ilia)
 - Fixed bug #32932 (Oracle LDAP: ldap_get_entries invalid pointer). (Jani)

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

Reply via email to