cvs: php4 /ext/sockets sockets.c

From: Date: Mon, 12 Nov 2001 00:58:17 +0000
Subject: cvs: php4 /ext/sockets sockets.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-8151@lists.php.net to get a copy of this message
mfischer Sun Nov 11 19:58:17 2001 EDT Modified files: /php4/ext/sockets sockets.c Log: Fix #14020 and some minor leaks. Index: php4/ext/sockets/sockets.c diff -u php4/ext/sockets/sockets.c:1.75 php4/ext/sockets/sockets.c:1.76 --- php4/ext/sockets/sockets.c:1.75 Thu Nov 1 15:10:17 2001 +++ php4/ext/sockets/sockets.c Sun Nov 11 19:58:16 2001 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.75 2001/11/01 20:10:17 dbeu Exp $ */ +/* $Id: sockets.c,v 1.76 2001/11/12 00:58:16 mfischer Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -899,8 +899,10 @@ int arg1, arg2, arg3; php_socket *php_sock = (php_socket*)emalloc(sizeof(php_socket)); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &arg1, &arg2, &arg3) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &arg1, &arg2, &arg3) == FAILURE) { + efree(php_sock); return; + } if (arg1 != AF_UNIX && arg1 != AF_INET) { php_error(E_WARNING, "Invalid socket domain [%d] specified, assuming AF_INET", arg1); @@ -1026,6 +1028,7 @@ sa->sun_family = AF_UNIX; snprintf(sa->sun_path, 108, "%s", addr); retval = bind(php_sock->bsd_socket, (struct sockaddr *) sa, SUN_LEN(sa)); + break; } case AF_INET: @@ -1044,6 +1047,7 @@ sa.sin_family = hp->h_addrtype; sa.sin_port = htons((unsigned short)port); retval = bind(php_sock->bsd_socket, (struct sockaddr *)&sa, sizeof(sa)); + break; } default: @@ -1818,6 +1822,8 @@ zval_dtor(fds_array_zval); if (array_init(fds_array_zval) == FAILURE) { php_error(E_WARNING, "Can't initialize fds array"); + efree(php_sock[0]); + efree(php_sock[1]); RETURN_FALSE; }

« previous php.cvs (#8151) next »