mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Fix potential memory leak in request_set_header.
This commit is contained in:
parent
7c363df6b5
commit
d406908e94
@ -1,3 +1,8 @@
|
|||||||
|
2005-04-17 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* http.c (request_set_header): Free NAME when VALUE is NULL and
|
||||||
|
freeing the header name is requested.
|
||||||
|
|
||||||
2005-04-17 Hrvoje Niksic <hniksic@xemacs.org>
|
2005-04-17 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* snprintf.c (fmtstr): Declare VALUE as const char *.
|
* snprintf.c (fmtstr): Declare VALUE as const char *.
|
||||||
|
@ -234,7 +234,13 @@ request_set_header (struct request *req, char *name, char *value,
|
|||||||
struct request_header *hdr;
|
struct request_header *hdr;
|
||||||
int i;
|
int i;
|
||||||
if (!value)
|
if (!value)
|
||||||
|
{
|
||||||
|
/* A NULL value is a no-op; if freeing the name is requested,
|
||||||
|
free it now to avoid leaks. */
|
||||||
|
if (release_policy == rel_name || release_policy == rel_both)
|
||||||
|
xfree (name);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
for (i = 0; i < req->hcount; i++)
|
for (i = 0; i < req->hcount; i++)
|
||||||
{
|
{
|
||||||
hdr = &req->headers[i];
|
hdr = &req->headers[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user