cvs: php-src /ext/sockets sockets.c

From: Date: Thu, 12 May 2005 16:26:27 +0000
Subject: cvs: php-src /ext/sockets sockets.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-31855@lists.php.net to get a copy of this message
tony2001 Thu May 12 12:26:27 2005 EDT Modified files: /php-src/ext/sockets sockets.c Log: 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.169&r2=1.170&ty=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.169 php-src/ext/sockets/sockets.c:1.170 --- php-src/ext/sockets/sockets.c:1.169 Mon Feb 14 18:44:23 2005 +++ php-src/ext/sockets/sockets.c Thu May 12 12:26:26 2005 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.169 2005/02/14 23:44:23 sniper Exp $ */ +/* $Id: sockets.c,v 1.170 2005/05/12 16:26:26 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -321,6 +321,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); } @@ -335,6 +339,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);

« previous php.cvs (#31855) next »