Commit 3dc93a42 authored by Daniel Veillard's avatar Daniel Veillard

cleanup patches from Peter Breitenlohner Daniel

* nanoftp.c nanohttp.c: cleanup patches from Peter Breitenlohner
Daniel
parent df101d83
Thu Jul 10 16:02:47 CEST 2003 Daniel Veillard <daniel@veillard.com>
* nanoftp.c nanohttp.c: cleanup patches from Peter Breitenlohner
Tue Jul 8 16:02:19 CEST 2003 Daniel Veillard <daniel@veillard.com>
* globals.c threads.c: fixes some problem when freeing unititialized
......
......@@ -1044,7 +1044,12 @@ xmlNanoFTPConnect(void *ctx) {
if (tmp->ai_family == AF_INET || tmp->ai_family == AF_INET6)
break;
if (tmp) {
if (!tmp) {
if (result)
freeaddrinfo (result);
return (-1);
}
else {
if (tmp->ai_family == AF_INET6) {
memcpy (&ctxt->ftpAddr, tmp->ai_addr, tmp->ai_addrlen);
((struct sockaddr_in6 *) &ctxt->ftpAddr)->sin6_port = htons (port);
......
......@@ -996,14 +996,13 @@ xmlNanoHTTPConnectHost(const char *host, int port)
}
for (res = result; res; res = res->ai_next) {
if (res) {
if (res->ai_family == AF_INET || res->ai_family == AF_INET6) {
if (res->ai_family == AF_INET6) {
memcpy (&sockin6, res->ai_addr, res->ai_addrlen);
sockin6.sin6_port = htons (port);
addr = (struct sockaddr *)&sockin6;
}
if (res->ai_family == AF_INET) {
else {
memcpy (&sockin, res->ai_addr, res->ai_addrlen);
sockin.sin_port = htons (port);
addr = (struct sockaddr *)&sockin;
......@@ -1015,11 +1014,10 @@ xmlNanoHTTPConnectHost(const char *host, int port)
return (s);
}
}
else {
freeaddrinfo (result);
return (-1);
}
}
if (result)
freeaddrinfo (result);
return (-1);
} else
#endif
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment