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/
This commit is contained in:
Doug Torrance 2016-02-07 00:53:17 -05:00 committed by Carlos R. Mafra
parent e64a950200
commit 575318c566
2 changed files with 2 additions and 0 deletions

View file

@ -373,6 +373,7 @@ static void load_rcfile (ServerConfig *cfg)
if ((rcfp = fopen (rcfile, "rt"))) { if ((rcfp = fopen (rcfile, "rt"))) {
read_rcfile (rcfp, cfg); read_rcfile (rcfp, cfg);
fclose (rcfp);
} else { } else {
/* rcfiles are fully optional... */ /* rcfiles are fully optional... */
debug_sys ("Could not open rcfile '%s'", rcfile); debug_sys ("Could not open rcfile '%s'", rcfile);

View file

@ -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, " To file: %s\n", job->options.save_to);
fprintf (error_file, " Error: %s\n", msg); fprintf (error_file, " Error: %s\n", msg);
fprintf (error_file, " (" WMGET_VERSION_BANNER ")\n"); fprintf (error_file, " (" WMGET_VERSION_BANNER ")\n");
fclose (error_file);
} }