summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Murzov2011-09-12 00:27:28 +0400
committerJason Woodward2011-09-12 09:39:34 +0000
commita5b3625ac5c71daf3b8fc5c2d01ca973783d4cc6 (patch)
tree6cd2c90981accebbad45412aff3cbfe35c9fb85e
parentd607b996b87e0f29b174558b83290c1654b59378 (diff)
downloadslapt-get-a5b3625ac5c71daf3b8fc5c2d01ca973783d4cc6.tar.gz
Fix resource leaks on error paths
Spotted by cppcheck: [src/package.c:2371]: (error) Resource leak: dir [src/package.c:2451]: (error) Resource leak: dir
-rw-r--r--src/package.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/package.c b/src/package.c
index 04f307d..5e1cf6f 100644
--- a/src/package.c
+++ b/src/package.c
@@ -2368,6 +2368,7 @@ void slapt_purge_old_cached_pkgs(const slapt_rc_config *global_config,
perror(dir_name);
fprintf(stderr,gettext("Failed to chdir: %s\n"),dir_name);
+ closedir(dir);
return;
}
@@ -2448,6 +2449,7 @@ void slapt_clean_pkg_dir(const char *dir_name)
if (chdir(dir_name) == -1 ) {
fprintf(stderr,gettext("Failed to chdir: %s\n"),dir_name);
+ closedir(dir);
return;
}