Correct minor mistakes in syntax. Prevent a leak in http_loop.

This commit is contained in:
Ilim Ugur 2012-07-24 23:59:47 +03:00
parent 40493a76fe
commit 9fd1e97e40
3 changed files with 5 additions and 3 deletions

View File

@ -3243,7 +3243,7 @@ Remote file exists.\n\n"));
while (!opt.ntry || (count < opt.ntry));
exit:
if (ret == RETROK && local_file)
if (ret == RETROK && local_file && !(*local_file))
*local_file = xstrdup (hstat.local_file);
free_hstat (&hstat);

View File

@ -4,9 +4,10 @@
#include <semaphore.h>
#include <errno.h>
#include "wget.h"
#include "multi.h"
#include "url.h"
#include "wget.h"
int
spawn_thread (struct s_thread_ctx *thread_ctx, char * name, int index, int resource)

View File

@ -1039,7 +1039,7 @@ retrieve_from_file (const char *file, bool html, int *count)
for (k = 0; k < num_of_resources; ++k)
ranges[j].resources[k] = false;
}
ranges[k-1].last_byte = file->size -1;
ranges[j-1].last_byte = file->size -1;
sem_init (&retr_sem, 0, 0);
j = ranges_covered = 0;
@ -1175,6 +1175,7 @@ retrieve_from_file (const char *file, bool html, int *count)
free(ranges[j].resources);
for (j = 0; j < N_THREADS; ++j)
free(files[j]);
++i;
}
free(files);