]> sjero.net Git - wget/blobdiff - src/init.c
Remove static modifier for functions used in other modules.
[wget] / src / init.c
index d5f9a4f09bdb9c0d447a59b0333df96a59555915..cafd456cd2befc18d89e33bbbdc58600a435eaef 100644 (file)
@@ -30,6 +30,7 @@ shall include the source code for the parts of OpenSSL used as well
 as that of the covered work.  */
 
 #include "wget.h"
+#include "exits.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -66,6 +67,7 @@ as that of the covered work.  */
 #include "res.h"                /* for res_cleanup */
 #include "http.h"               /* for http_cleanup */
 #include "retr.h"               /* for output_stream */
+#include "warc.h"               /* for warc_close */
 
 #ifdef TESTING
 #include "test.h"
@@ -1667,6 +1669,7 @@ decode_string (const char *val, const struct decode_item *items, int itemcount,
 
 \f
 void cleanup_html_url (void);
+void spider_cleanup (void);
 
 
 /* Free the memory allocated by global variables.  */
@@ -1675,8 +1678,16 @@ 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);
+    if (fclose (output_stream) == EOF)
+      inform_exit_status (CLOSEFAILED);
+
   /* No need to check for error because Wget flushes its output (and
      checks for errors) after any data arrives.  */
 
@@ -1693,9 +1704,13 @@ cleanup (void)
   res_cleanup ();
   http_cleanup ();
   cleanup_html_url ();
+  spider_cleanup ();
   host_cleanup ();
   log_cleanup ();
 
+  for (i = 0; i < nurl; i++)
+    xfree (url[i]);
+
   {
     extern acc_t *netrc_list;
     free_netrc (netrc_list);