moriyoshi Fri Apr 4 09:18:31 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/sockets sockets.c Log: MFH(r-1.135): fixed memleak in socket_select() Index: php4/ext/sockets/sockets.c diff -u php4/ext/sockets/sockets.c:1.125.2.9 php4/ext/sockets/sockets.c:1.125.2.10 --- php4/ext/sockets/sockets.c:1.125.2.9 Tue Apr 1 13:12:24 2003 +++ php4/ext/sockets/sockets.c Fri Apr 4 09:18:31 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.125.2.9 2003/04/01 18:12:24 rasmus Exp $ */ +/* $Id: sockets.c,v 1.125.2.10 2003/04/04 14:18:31 moriyoshi Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -576,10 +576,21 @@ /* If seconds is not set to null, build the timeval, else we wait indefinitely */ if (sec != NULL) { - convert_to_long_ex(&sec); + zval tmp; + + if (Z_TYPE_P(sec) != IS_LONG) { + tmp = *sec; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + sec = &tmp; + } tv.tv_sec = Z_LVAL_P(sec); tv.tv_usec = usec; tv_p = &tv; + + if (sec == &tmp) { + zval_dtor(&tmp); + } } retval = select(max_fd+1, &rfds, &wfds, &efds, tv_p);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php