cvs: php4 /ext/sockets sockets.c
| From: | Stanislav Malyshev | Date: | Tue, 12 Dec 2000 17:02:12 +0000 |
| Subject: | cvs: php4 /ext/sockets sockets.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-3096@lists.php.net to get a copy of this message | ||
stas Tue Dec 12 09:02:12 2000 EDT
Modified files:
/php4/ext/sockets sockets.c
Log:
Fix memory leak
Index: php4/ext/sockets/sockets.c
diff -u php4/ext/sockets/sockets.c:1.25 php4/ext/sockets/sockets.c:1.26
--- php4/ext/sockets/sockets.c:1.25 Tue Dec 12 08:56:34 2000
+++ php4/ext/sockets/sockets.c Tue Dec 12 09:02:12 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.25 2000/12/12 16:56:34 stas Exp $ */
+/* $Id: sockets.c,v 1.26 2000/12/12 17:02:12 stas Exp $ */
#include "php.h"
@@ -692,6 +692,10 @@
ret = (*read_function)(Z_LVAL_PP(fd), tmpbuf, Z_LVAL_PP(length));
if (ret >= 0) {
+ if(Z_STRLEN_PP(buf) > 0) {
+ efree(Z_STRVAL_PP(buf));
+ }
+
tmpbuf[ret] = '\0';
Z_STRVAL_PP(buf) = erealloc(tmpbuf, ret+1);
Z_STRLEN_PP(buf) = ret;