From: hniksic Date: Fri, 31 Mar 2000 14:14:58 +0000 (-0800) Subject: [svn] More old fixes. X-Git-Tag: v1.13~2496 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=bc7060a81d6f750b004ddceb9cdc73cf7df58d3d [svn] More old fixes. --- diff --git a/src/ChangeLog b/src/ChangeLog index 20e6c098..14e580d0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +1998-10-17 Hrvoje Niksic + + * http.c (http_process_type): Removed needless strdup(), a memory + leak. + +1998-09-25 Hrvoje Niksic + + * html.c (htmlfindurl): Set PH to the first occurrence of `#'. + 1998-09-25 Simon Munton * init.c (wgetrc_file_name): Don't free HOME under Windows. diff --git a/src/html.c b/src/html.c index 51a8233e..c8767d6e 100644 --- a/src/html.c +++ b/src/html.c @@ -264,7 +264,7 @@ htmlfindurl (const char *buf, int bufsize, int *size, int init) for (++buf, --bufsize; bufsize && *buf != s->quote_char && *buf != '\n'; ++buf, --bufsize) - if (*buf == '#') + if (ph && *buf == '#') ph = buf; if (!bufsize) { @@ -287,7 +287,7 @@ htmlfindurl (const char *buf, int bufsize, int *size, int init) { p = buf; for (; bufsize && !ISSPACE (*buf) && *buf != '>'; ++buf, --bufsize) - if (*buf == '#') + if (ph && *buf == '#') ph = buf; if (!bufsize) break; diff --git a/src/http.c b/src/http.c index aaaeb580..effd0c97 100644 --- a/src/http.c +++ b/src/http.c @@ -241,7 +241,6 @@ http_process_type (const char *hdr, void *arg) char **result = (char **)arg; char *p; - *result = xstrdup (hdr); p = strrchr (hdr, ';'); if (p) { @@ -458,13 +457,16 @@ gethttp (struct urlinfo *u, struct http_stat *hs, int *dt) remhost = ou->host; remport = ou->port; - if (remport == 80) { - host_port = NULL; host_port_len = 0; - } - else { + if (remport == 80) + { + host_port = NULL; + host_port_len = 0; + } + else + { host_port = (char *)alloca (numdigit (remport) + 2); host_port_len = sprintf (host_port, ":%d", remport); - } + } /* Allocate the memory for the request. */ request = (char *)alloca (strlen (command) + strlen (path)