diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-09-11 14:49:07 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-09-11 14:49:07 +0200 |
commit | 4d860005419bf23874fffd1f53663f50be6826e9 (patch) | |
tree | e96822236391febf1371ce04713c15ad71c6d54c /main | |
parent | f293e6b92003d02fe7db81861500e8ff8fb771c4 (diff) | |
parent | e41867888a76da3c270afe8dc86352e41d1f8c39 (diff) | |
download | php-git-4d860005419bf23874fffd1f53663f50be6826e9.tar.gz |
Merge branch 'PHP-7.4' into master
* PHP-7.4:
Fix #80067: Omitting the port in bindto setting errors
Diffstat (limited to 'main')
-rw-r--r-- | main/network.c | 12 | ||||
-rw-r--r-- | main/streams/xp_socket.c | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/main/network.c b/main/network.c index ac4a2a3357..2c504952b2 100644 --- a/main/network.c +++ b/main/network.c @@ -197,6 +197,10 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka if ((n = getaddrinfo(host, NULL, &hints, &res))) { if (error_string) { + /* free error string received during previous iteration (if any) */ + if (*error_string) { + zend_string_release_ex(*error_string, 0); + } *error_string = strpprintf(0, "php_network_getaddresses: getaddrinfo failed: %s", PHP_GAI_STRERROR(n)); php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(*error_string)); } else { @@ -205,6 +209,10 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka return 0; } else if (res == NULL) { if (error_string) { + /* free error string received during previous iteration (if any) */ + if (*error_string) { + zend_string_release_ex(*error_string, 0); + } *error_string = strpprintf(0, "php_network_getaddresses: getaddrinfo failed (null result pointer) errno=%d", errno); php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(*error_string)); } else { @@ -238,6 +246,10 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka } if (host_info == NULL) { if (error_string) { + /* free error string received during previous iteration (if any) */ + if (*error_string) { + zend_string_release_ex(*error_string, 0); + } *error_string = strpprintf(0, "php_network_getaddresses: gethostbyname failed. errno=%d", errno); php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(*error_string)); } else { diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 22eb976f7d..f3370e89f7 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -747,10 +747,6 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ return -1; } bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text); - if (bindto == NULL) { - efree(host); - return -1; - } } #ifdef SO_BROADCAST |