1 --- busybox-1.19.3/networking/wget.c
2 +++ busybox-1.19.3-wget/networking/wget.c
3 @@ -552,6 +552,7 @@ static void download_one_url(const char
4 FILE *dfp; /* socket to ftp server (data) */
7 + char *redirected_path = NULL;
8 struct host_info server;
9 struct host_info target;
11 @@ -794,8 +795,8 @@ However, in real world it was observed t
12 bb_error_msg_and_die("too many redirections");
15 - free(target.allocated);
16 - target.path = target.allocated = xstrdup(str+1);
17 + free(redirected_path);
18 + target.path = redirected_path = xstrdup(str+1);
19 /* lsa stays the same: it's on the same server */
21 parse_url(str, &target);
22 @@ -850,6 +851,7 @@ However, in real world it was observed t
23 free(server.allocated);
24 free(target.allocated);
25 free(fname_out_alloc);
26 + free(redirected_path);
29 int wget_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;