summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-06-06 23:19:26 +0200
committerYorhel <git@yorhel.nl>2009-06-06 23:22:30 +0200
commite5cc7703d7d926a1765fccd123df2b81f3368640 (patch)
tree2a32f85677687e63653325c159a919ea1f6042e2
parent21f2e627937176cd857cab25c481bb0b7d8cf60f (diff)
Properly free return value of opendir() on calculation interrupt
When interrupinting the calculation process by pressing 'q' while it's looping through a directory, or when a directory could be openend but not chdir()'ed into, closedir() wasn't called.
-rw-r--r--ChangeLog1
-rw-r--r--src/calc.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ccbb3c8..bc7a44e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ git - ?
- Properly select the next item after deletion
- Removed reliance of dirfd()
- Fixed non-void return in void delete_process()
+ - Fixed several tiny memory leaks
1.5 - 2009-05-02
- Fixed incorrect apparent size on directory refresh
diff --git a/src/calc.c b/src/calc.c
index 23f142a..cceb9a9 100644
--- a/src/calc.c
+++ b/src/calc.c
@@ -177,6 +177,8 @@ int calc_dir(struct dir *dest, char *name) {
while((t = t->parent) != NULL)
t->flags |= FF_SERR;
calc_leavepath();
+ if(dir != NULL)
+ closedir(dir);
return 0;
}
@@ -187,6 +189,7 @@ int calc_dir(struct dir *dest, char *name) {
dest->flags |= FF_ERR;
if(input_handle(1)) {
calc_leavepath();
+ closedir(dir);
return 1;
}
calc_leavepath();