From 575318c5663c7136aac9446de6db89758c9c8ced Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sun, 7 Feb 2016 00:53:17 -0500 Subject: [PATCH] wmget: Fix resource leaks. 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); }