moriyoshi Fri Apr 4 09:16:59 2003 EDT Modified files: /php4/ext/sockets sockets.c Log: Fixed memleak in socket_select Index: php4/ext/sockets/sockets.c diff -u php4/ext/sockets/sockets.c:1.134 php4/ext/sockets/sockets.c:1.135 --- php4/ext/sockets/sockets.c:1.134 Fri Apr 4 08:02:43 2003 +++ php4/ext/sockets/sockets.c Fri Apr 4 09:16:59 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.134 2003/04/04 13:02:43 moriyoshi Exp $ */ +/* $Id: sockets.c,v 1.135 2003/04/04 14:16:59 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