mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
src/ftp.c: make sure warc_tmp becomes closed before return
Reported-by: Coverity bug #1188044
This commit is contained in:
parent
014b1d6041
commit
799c545722
11
src/ftp.c
11
src/ftp.c
@ -1696,7 +1696,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_fi
|
|||||||
case UNLINKERR: case WARC_TMP_FWRITEERR:
|
case UNLINKERR: case WARC_TMP_FWRITEERR:
|
||||||
/* Fatal errors, give up. */
|
/* Fatal errors, give up. */
|
||||||
if (warc_tmp != NULL)
|
if (warc_tmp != NULL)
|
||||||
fclose (warc_tmp);
|
fclose (warc_tmp);
|
||||||
return err;
|
return err;
|
||||||
case CONSOCKERR: case CONERROR: case FTPSRVERR: case FTPRERR:
|
case CONSOCKERR: case CONERROR: case FTPSRVERR: case FTPRERR:
|
||||||
case WRITEFAILED: case FTPUNKNOWNTYPE: case FTPSYSERR:
|
case WRITEFAILED: case FTPUNKNOWNTYPE: case FTPSYSERR:
|
||||||
@ -1771,10 +1771,12 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_fi
|
|||||||
|
|
||||||
warc_res = warc_write_resource_record (NULL, u->url, NULL, NULL,
|
warc_res = warc_write_resource_record (NULL, u->url, NULL, NULL,
|
||||||
warc_ip, NULL, warc_tmp, -1);
|
warc_ip, NULL, warc_tmp, -1);
|
||||||
|
|
||||||
if (! warc_res)
|
if (! warc_res)
|
||||||
return WARC_ERR;
|
return WARC_ERR;
|
||||||
|
|
||||||
/* warc_write_resource_record has also closed warc_tmp. */
|
/* warc_write_resource_record has also closed warc_tmp. */
|
||||||
|
warc_tmp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (con->cmd & DO_LIST)
|
if (con->cmd & DO_LIST)
|
||||||
@ -1821,6 +1823,9 @@ Removing file due to --delete-after in ftp_loop_internal():\n"));
|
|||||||
if (local_file)
|
if (local_file)
|
||||||
*local_file = xstrdup (locf);
|
*local_file = xstrdup (locf);
|
||||||
|
|
||||||
|
if (warc_tmp != NULL)
|
||||||
|
fclose (warc_tmp);
|
||||||
|
|
||||||
return RETROK;
|
return RETROK;
|
||||||
} while (!opt.ntry || (count < opt.ntry));
|
} while (!opt.ntry || (count < opt.ntry));
|
||||||
|
|
||||||
@ -1829,6 +1834,10 @@ Removing file due to --delete-after in ftp_loop_internal():\n"));
|
|||||||
fd_close (con->csock);
|
fd_close (con->csock);
|
||||||
con->csock = -1;
|
con->csock = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (warc_tmp != NULL)
|
||||||
|
fclose (warc_tmp);
|
||||||
|
|
||||||
return TRYLIMEXC;
|
return TRYLIMEXC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user