mirror of
https://github.com/mirror/wget.git
synced 2025-01-14 22:30:44 +08:00
Fix use of idn2_free()
* src/connect.c (connect_to_ip): Use xfree() instead of idn2_free() * src/host.c (lookup_host): Use xfree() instead of idn2_free() * src/iri.h: Do not include idn2.h * src/url.c (url_free): Use xfree() instead of idn2_free() * src/url.h (struct url): Remove 'idn_allocated' from struct Reported-by: Gisle Vanem
This commit is contained in:
parent
7ffe93cabb
commit
6ef493b19e
@ -56,10 +56,6 @@ as that of the covered work. */
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef ENABLE_IRI
|
||||
#include <idn2.h>
|
||||
#endif
|
||||
|
||||
#include "utils.h"
|
||||
#include "host.h"
|
||||
#include "connect.h"
|
||||
@ -280,11 +276,8 @@ connect_to_ip (const ip_address *ip, int port, const char *print)
|
||||
|
||||
if (opt.enable_iri && (name = idn_decode ((char *) print)) != NULL)
|
||||
{
|
||||
int len = strlen (print) + strlen (name) + 4;
|
||||
str = xmalloc (len);
|
||||
snprintf (str, len, "%s (%s)", name, print);
|
||||
str[len-1] = '\0';
|
||||
idn2_free (name);
|
||||
str = aprintf ("%s (%s)", name, print);
|
||||
xfree (name);
|
||||
}
|
||||
|
||||
logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),
|
||||
|
11
src/host.c
11
src/host.c
@ -57,10 +57,6 @@ as that of the covered work. */
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef ENABLE_IRI
|
||||
#include <idn2.h>
|
||||
#endif
|
||||
|
||||
#include "utils.h"
|
||||
#include "host.h"
|
||||
#include "url.h"
|
||||
@ -846,11 +842,8 @@ lookup_host (const char *host, int flags)
|
||||
|
||||
if (opt.enable_iri && (name = idn_decode ((char *) host)) != NULL)
|
||||
{
|
||||
int len = strlen (host) + strlen (name) + 4;
|
||||
str = xmalloc (len);
|
||||
snprintf (str, len, "%s (%s)", name, host);
|
||||
str[len-1] = '\0';
|
||||
idn2_free (name);
|
||||
str = aprintf ("%s (%s)", name, host);
|
||||
xfree (name);
|
||||
}
|
||||
|
||||
logprintf (LOG_VERBOSE, _("Resolving %s... "),
|
||||
|
@ -40,8 +40,6 @@ struct iri {
|
||||
|
||||
#ifdef ENABLE_IRI
|
||||
|
||||
# include <idn2.h>
|
||||
|
||||
char *parse_charset (const char *str);
|
||||
const char *find_locale (void);
|
||||
bool check_encoding_name (const char *encoding);
|
||||
|
@ -944,7 +944,6 @@ url_parse (const char *url, int *error, struct iri *iri, bool percent_encode)
|
||||
{
|
||||
xfree (u->host);
|
||||
u->host = new;
|
||||
u->idn_allocated = true;
|
||||
host_modified = true;
|
||||
}
|
||||
}
|
||||
@ -1223,12 +1222,7 @@ url_free (struct url *url)
|
||||
{
|
||||
if (url)
|
||||
{
|
||||
if (url->idn_allocated) {
|
||||
idn2_free (url->host); /* A dummy if !defined(ENABLE_IRI) */
|
||||
url->host = NULL;
|
||||
}
|
||||
else
|
||||
xfree (url->host);
|
||||
xfree (url->host);
|
||||
|
||||
xfree (url->path);
|
||||
xfree (url->url);
|
||||
|
Loading…
Reference in New Issue
Block a user