projects
/
haskell-directory.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
[project @ 2003-11-05 09:58:01 by simonmar]
[haskell-directory.git]
/
cbits
/
dirUtils.c
diff --git
a/cbits/dirUtils.c
b/cbits/dirUtils.c
index
4422440
..
f256463
100644
(file)
--- a/
cbits/dirUtils.c
+++ b/
cbits/dirUtils.c
@@
-81,7
+81,11
@@
__hscore_readdir( HsAddr dirPtr, HsAddr pDirEnt )
if (p == NULL) return -1;
res = readdir_r((DIR*)dirPtr, p, pDirE);
if (res != 0) {
- *pDirE = NULL;
+ *pDirE = NULL;
+ free(p);
+ }
+ else if (*pDirE == NULL) {
+ // end of stream
free(p);
}
return res;