cvs: php4 /ext/sockets sockets.c

From: Date: Thu, 14 Sep 2000 21:48:15 +0000
Subject: cvs: php4 /ext/sockets sockets.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1760@lists.php.net to get a copy of this message
chrisv Thu Sep 14 14:48:15 2000 EDT Modified files: /php4/ext/sockets sockets.c Log: Corrected memory leak in read(). Index: php4/ext/sockets/sockets.c diff -u php4/ext/sockets/sockets.c:1.12 php4/ext/sockets/sockets.c:1.13 --- php4/ext/sockets/sockets.c:1.12 Wed Sep 13 16:33:39 2000 +++ php4/ext/sockets/sockets.c Thu Sep 14 14:48:15 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.12 2000/09/13 23:33:39 chrisv Exp $ */ +/* $Id: sockets.c,v 1.13 2000/09/14 21:48:15 chrisv Exp $ */ #include "php.h" @@ -602,11 +602,14 @@ ret = read(Z_LVAL_PP(fd), tmpbuf, Z_LVAL_PP(length)); if (ret >= 0) { - Z_STRVAL_PP(buf) = tmpbuf; + Z_STRVAL_PP(buf) = estrndup(tmpbuf,strlen(tmpbuf)); Z_STRLEN_PP(buf) = ret; + efree(tmpbuf); + RETURN_LONG(ret); } else { + efree(tmpbuf); RETURN_LONG(-errno); } }

« previous php.cvs (#1760) next »