From 90e9d9e1bd98dcb1ab286d696acf790cf3758a6a Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Sat, 16 Jun 2012 12:20:33 +0200 Subject: [PATCH] Move cleanup related code to `cleanup' --- src/ChangeLog | 3 +++ src/init.c | 9 +++++++++ src/main.c | 8 -------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index bd594522..b3937051 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2012-06-16 Giuseppe Scrivano + * main.c (main): Move some cleanup related function to... + * init.c (cleanup): ...here. + * main.c: Do not include "stdout.h". (main): Do not register `close_stdout' at exit. Reported by: Micah Cowan . diff --git a/src/init.c b/src/init.c index d5f9a4f0..40b62b27 100644 --- a/src/init.c +++ b/src/init.c @@ -1675,6 +1675,12 @@ cleanup (void) { /* Free external resources, close files, etc. */ + /* Close WARC file. */ + if (opt.warc_filename != 0) + warc_close (); + + log_close (); + if (output_stream) fclose (output_stream); /* No need to check for error because Wget flushes its output (and @@ -1696,6 +1702,9 @@ cleanup (void) host_cleanup (); log_cleanup (); + for (i = 0; i < nurl; i++) + xfree (url[i]); + { extern acc_t *netrc_list; free_netrc (netrc_list); diff --git a/src/main.c b/src/main.c index 291fe077..96d7d57f 100644 --- a/src/main.c +++ b/src/main.c @@ -1626,14 +1626,6 @@ outputting to a regular file.\n")); if (opt.convert_links && !opt.delete_after) convert_all_links (); - /* Close WARC file. */ - if (opt.warc_filename != 0) - warc_close (); - - log_close (); - - for (i = 0; i < nurl; i++) - xfree (url[i]); cleanup (); exit (get_exit_status ());