summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pr/src/pthreads/ptio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
index ee4782db..362bc296 100644
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -3708,7 +3708,10 @@ PR_IMPLEMENT(PRDir*) PR_OpenDir(const char *name)
else
{
dir = PR_NEWZAP(PRDir);
- dir->md.d = osdir;
+ if (dir)
+ dir->md.d = osdir;
+ else
+ (void)closedir(osdir);
}
return dir;
} /* PR_OpenDir */