mirror of
https://github.com/mirror/wget.git
synced 2025-03-29 13:30:30 +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 <string.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#ifdef ENABLE_IRI
|
|
||||||
#include <idn2.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "connect.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)
|
if (opt.enable_iri && (name = idn_decode ((char *) print)) != NULL)
|
||||||
{
|
{
|
||||||
int len = strlen (print) + strlen (name) + 4;
|
str = aprintf ("%s (%s)", name, print);
|
||||||
str = xmalloc (len);
|
xfree (name);
|
||||||
snprintf (str, len, "%s (%s)", name, print);
|
|
||||||
str[len-1] = '\0';
|
|
||||||
idn2_free (name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),
|
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>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef ENABLE_IRI
|
|
||||||
#include <idn2.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "url.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)
|
if (opt.enable_iri && (name = idn_decode ((char *) host)) != NULL)
|
||||||
{
|
{
|
||||||
int len = strlen (host) + strlen (name) + 4;
|
str = aprintf ("%s (%s)", name, host);
|
||||||
str = xmalloc (len);
|
xfree (name);
|
||||||
snprintf (str, len, "%s (%s)", name, host);
|
|
||||||
str[len-1] = '\0';
|
|
||||||
idn2_free (name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logprintf (LOG_VERBOSE, _("Resolving %s... "),
|
logprintf (LOG_VERBOSE, _("Resolving %s... "),
|
||||||
|
@ -40,8 +40,6 @@ struct iri {
|
|||||||
|
|
||||||
#ifdef ENABLE_IRI
|
#ifdef ENABLE_IRI
|
||||||
|
|
||||||
# include <idn2.h>
|
|
||||||
|
|
||||||
char *parse_charset (const char *str);
|
char *parse_charset (const char *str);
|
||||||
const char *find_locale (void);
|
const char *find_locale (void);
|
||||||
bool check_encoding_name (const char *encoding);
|
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);
|
xfree (u->host);
|
||||||
u->host = new;
|
u->host = new;
|
||||||
u->idn_allocated = true;
|
|
||||||
host_modified = true;
|
host_modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1223,12 +1222,7 @@ url_free (struct url *url)
|
|||||||
{
|
{
|
||||||
if (url)
|
if (url)
|
||||||
{
|
{
|
||||||
if (url->idn_allocated) {
|
xfree (url->host);
|
||||||
idn2_free (url->host); /* A dummy if !defined(ENABLE_IRI) */
|
|
||||||
url->host = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
xfree (url->host);
|
|
||||||
|
|
||||||
xfree (url->path);
|
xfree (url->path);
|
||||||
xfree (url->url);
|
xfree (url->url);
|
||||||
|
@ -99,10 +99,6 @@ struct url
|
|||||||
/* Username and password (unquoted). */
|
/* Username and password (unquoted). */
|
||||||
char *user;
|
char *user;
|
||||||
char *passwd;
|
char *passwd;
|
||||||
|
|
||||||
/* 'host' is allocated by idn2_lookup_u8() via idn_encode().
|
|
||||||
* Call 'idn2_free()' to free this memory. */
|
|
||||||
bool idn_allocated;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Function declarations */
|
/* Function declarations */
|
||||||
|
Loading…
Reference in New Issue
Block a user