diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2010-06-09 09:59:52 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-06-10 10:17:38 -0400 |
commit | 8b164f115d694d6f7c4bc2b2853c1860679bfaa6 (patch) | |
tree | b9517b44167db3fbabc3b0e967c67716199ecaf6 /path_utils | |
parent | c06735031379e0dae58c19f3ab922258248d9c26 (diff) | |
download | ding-libs-8b164f115d694d6f7c4bc2b2853c1860679bfaa6.tar.gz ding-libs-8b164f115d694d6f7c4bc2b2853c1860679bfaa6.tar.xz ding-libs-8b164f115d694d6f7c4bc2b2853c1860679bfaa6.zip |
Don't leak directory access resources on errors in directory_list()
https://fedorahosted.org/sssd/ticket/514
Diffstat (limited to 'path_utils')
-rw-r--r-- | path_utils/path_utils.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/path_utils/path_utils.c b/path_utils/path_utils.c index 493e0a4..97c845c 100644 --- a/path_utils/path_utils.c +++ b/path_utils/path_utils.c @@ -538,6 +538,10 @@ int directory_list(const char *path, bool recursive, error = path_concat(entry_path, sizeof(entry_path), path, entry->d_name); if (error != SUCCESS) { + closedir(dir); + /* Don't bother checking the return here. + * The path_concat error is more important + */ return error; } @@ -551,6 +555,10 @@ int directory_list(const char *path, bool recursive, error = directory_list(entry_path, recursive, callback, user_data); if (error != SUCCESS) { + closedir(dir); + /* Don't bother checking the return here. + * The directory_list error is more important + */ return error; } } |