From: Stanislav Malyshev Date: Tue, 12 Dec 2000 17:02:12 +0000 (+0000) Subject: Fix memory leak X-Git-Tag: php-4.0.5RC1~922 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3abdbd3de9ca5d5b7c6ff04eae87e7605c71c563;p=php Fix memory leak --- diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index c9464d4620..6db0c5d2c1 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -692,6 +692,10 @@ PHP_FUNCTION(read) 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;