]> granicus.if.org Git - php/commitdiff
Fix memory leak
authorStanislav Malyshev <stas@php.net>
Tue, 12 Dec 2000 17:02:12 +0000 (17:02 +0000)
committerStanislav Malyshev <stas@php.net>
Tue, 12 Dec 2000 17:02:12 +0000 (17:02 +0000)
ext/sockets/sockets.c

index c9464d4620f664e5b5cf46710e86d366d5b619a0..6db0c5d2c186192dabb64f3c572294ea8d8a3dcb 100644 (file)
@@ -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;