mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Fix issues reported by static code analysis tool 'parfait'
Closes: #41235 Reported-by: Jiri Kukacka
This commit is contained in:
parent
4850e9c873
commit
e4583ab364
@ -1,3 +1,11 @@
|
|||||||
|
2014-12-01 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||||
|
|
||||||
|
* connect.c, iri.c, url.c, warc.c: Fix issues reported
|
||||||
|
by static code analysis tool 'parfait'.
|
||||||
|
|
||||||
|
Closes: #41235
|
||||||
|
Reported-by: Jiri Kukacka
|
||||||
|
|
||||||
2014-11-29 Tim Ruehsen <tim.ruehsen@gmx.de>
|
2014-11-29 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||||
|
|
||||||
* utils.h: xfree() sets argument to NULL after freeing,
|
* utils.h: xfree() sets argument to NULL after freeing,
|
||||||
|
@ -844,7 +844,7 @@ void *
|
|||||||
fd_transport_context (int fd)
|
fd_transport_context (int fd)
|
||||||
{
|
{
|
||||||
struct transport_info *info = hash_table_get (transport_map, (void *)(intptr_t) fd);
|
struct transport_info *info = hash_table_get (transport_map, (void *)(intptr_t) fd);
|
||||||
return info->ctx;
|
return info ? info->ctx : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When fd_read/fd_write are called multiple times in a loop, they should
|
/* When fd_read/fd_write are called multiple times in a loop, they should
|
||||||
|
@ -328,12 +328,15 @@ struct iri *iri_dup (const struct iri *src)
|
|||||||
/* Completely free an iri structure. */
|
/* Completely free an iri structure. */
|
||||||
void
|
void
|
||||||
iri_free (struct iri *i)
|
iri_free (struct iri *i)
|
||||||
|
{
|
||||||
|
if (i)
|
||||||
{
|
{
|
||||||
xfree (i->uri_encoding);
|
xfree (i->uri_encoding);
|
||||||
xfree (i->content_encoding);
|
xfree (i->content_encoding);
|
||||||
xfree (i->orig_url);
|
xfree (i->orig_url);
|
||||||
xfree (i);
|
xfree (i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Set uri_encoding of struct iri i. If a remote encoding was specified, use
|
/* Set uri_encoding of struct iri i. If a remote encoding was specified, use
|
||||||
it unless force is true. */
|
it unless force is true. */
|
||||||
|
@ -575,7 +575,7 @@ rewrite_shorthand_url (const char *url)
|
|||||||
goto http;
|
goto http;
|
||||||
|
|
||||||
/* Turn "foo.bar.com:path" to "ftp://foo.bar.com/path". */
|
/* Turn "foo.bar.com:path" to "ftp://foo.bar.com/path". */
|
||||||
ret = aprintf ("ftp://%s", url);
|
if ((ret = aprintf ("ftp://%s", url)) != NULL)
|
||||||
ret[6 + (p - url)] = '/';
|
ret[6 + (p - url)] = '/';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1172,6 +1172,8 @@ url_set_file (struct url *url, const char *newfile)
|
|||||||
|
|
||||||
void
|
void
|
||||||
url_free (struct url *url)
|
url_free (struct url *url)
|
||||||
|
{
|
||||||
|
if (url)
|
||||||
{
|
{
|
||||||
xfree (url->host);
|
xfree (url->host);
|
||||||
xfree (url->path);
|
xfree (url->path);
|
||||||
@ -1188,6 +1190,7 @@ url_free (struct url *url)
|
|||||||
|
|
||||||
xfree (url);
|
xfree (url);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Create all the necessary directories for PATH (a file). Calls
|
/* Create all the necessary directories for PATH (a file). Calls
|
||||||
make_directory internally. */
|
make_directory internally. */
|
||||||
|
@ -1201,7 +1201,10 @@ warc_tempfile (void)
|
|||||||
|
|
||||||
#if !O_TEMPORARY
|
#if !O_TEMPORARY
|
||||||
if (unlink (filename) < 0)
|
if (unlink (filename) < 0)
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return fdopen (fd, "wb+");
|
return fdopen (fd, "wb+");
|
||||||
|
Loading…
Reference in New Issue
Block a user