[PATCH 3/6] wmget: Fix resource leaks.

Doug Torrance <[email protected]>
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
In particular, fclose() all the files we fopen().  From Debian [1].

[1] http://sources.debian.net/src/wmget/0.6.0-5/debian/patches/
    fix_resource_leaks.patch/
---
 wmget/configure.c | 1 +
 wmget/retrieve.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/wmget/configure.c b/wmget/configure.c
index 71678ed..d271e00 100644
--- a/wmget/configure.c
+++ b/wmget/configure.c
@@ -373,6 +373,7 @@ static void load_rcfile (ServerConfig *cfg)
 
     if ((rcfp = fopen (rcfile, "rt"))) {
         read_rcfile (rcfp, cfg);
+        fclose (rcfp);
     } else {
         /* rcfiles are fully optional... */
         debug_sys ("Could not open rcfile '%s'", rcfile);
diff --git a/wmget/retrieve.c b/wmget/retrieve.c
index 4ba2908..d58b7cb 100644
--- a/wmget/retrieve.c
+++ b/wmget/retrieve.c
@@ -98,6 +98,7 @@ void write_error_file (Job *job, const char *msg)
     fprintf (error_file, " To file: %s\n", job->options.save_to);
     fprintf (error_file, " Error: %s\n", msg);
     fprintf (error_file, " (" WMGET_VERSION_BANNER ")\n");
+    fclose (error_file);
 }
 
 
-- 
2.5.0


-- 
To unsubscribe, send mail to [email protected].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.