]> granicus.if.org Git - php/commitdiff
fix memleak when connection fails (and we still keep trying)
authorAntony Dovgal <tony2001@php.net>
Mon, 20 Jun 2005 23:16:27 +0000 (23:16 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 20 Jun 2005 23:16:27 +0000 (23:16 +0000)
main/network.c

index ae1941c2577fec13c4df552d6ff04404fa8595f8..7e66c1761b6b594a19b8766c9e9547a5aad85720 100644 (file)
@@ -817,7 +817,13 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
 bad_ip:
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid IP Address: %s", bindto);
                        }
-bind_done:                     
+bind_done:
+                       /* free error string recieved during previous iteration (if any) */
+                       if (error_string && *error_string) {
+                               efree(*error_string);
+                               *error_string = NULL;
+                       }
+                       
                        n = php_network_connect_socket(sock, sa, socklen, asynchronous,
                                        timeout ? &working_timeout : NULL,
                                        error_string, error_code);