aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar sin <sin@2f30.org>2014-10-10 10:12:01 +0100
committerGravatar sin <sin@2f30.org>2014-10-10 10:12:01 +0100
commit61cd0f8041e36757f4a02aa8894309412e35ccff (patch)
tree0aedfa1f92d64c1094684c221a1a1dadf5169359
parentbc2d9e7c11f010e3f2c8ccf6d9a082aafc1a98b8 (diff)
downloadnnn-61cd0f8041e36757f4a02aa8894309412e35ccff.tar.gz
Only closedir when dirp is valid
-rw-r--r--noice.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/noice.c b/noice.c
index 27a4b32..4c88701 100644
--- a/noice.c
+++ b/noice.c
@@ -552,9 +552,11 @@ out:
free(dents[i].name);
free(dents);
- r = closedir(dirp);
- if (r == -1)
- printerr(1, "closedir");
+ if (dirp != NULL) {
+ r = closedir(dirp);
+ if (r == -1)
+ printerr(1, "closedir");
+ }
goto begin;
}