Re: cvs: php4 /ext/sockets sockets.c

From: Date: Fri, 15 Sep 2000 07:44:53 +0000
Subject: Re: cvs: php4 /ext/sockets sockets.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1763@lists.php.net to get a copy of this message
I changed it as appropriate, and I'll commit the changes once the CVS server comes back up.. Chris On Fri, 15 Sep 2000, Andi Gutmans wrote: > > >+ Z_STRVAL_PP(buf) = estrndup(tmpbuf,strlen(tmpbuf)); > > Z_STRLEN_PP(buf) = ret; > > This doesn't make sense. Either Z_STRLEN_PP(buf) should be set to > strlen(tmpbuf) or ret is correct and you can use that in the estrndup() call. > > Andi > > At 09:48 PM 9/14/00 +0000, Chris Vandomelen wrote: > >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); > > } > > } > > > > > > > >-- > >PHP CVS Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net > >For additional commands, e-mail: php-cvs-help@lists.php.net > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > --- > Andi Gutmans <andi@zend.com> > http://www.zend.com/ >

« previous php.cvs (#1763) next »