aboutsummaryrefslogtreecommitdiffstats
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorJim Blandy1993-06-16 20:31:01 +0000
committerJim Blandy1993-06-16 20:31:01 +0000
commit1b929d2579bbd362e094f1087776a67dbbb8afea (patch)
tree9fc991541190c2da34488e8a505911e5bab94b23 /src/sysdep.c
parent37fd7901b2e694e07267ef6999875fb31fed70ad (diff)
downloademacs-1b929d2579bbd362e094f1087776a67dbbb8afea.tar.gz
emacs-1b929d2579bbd362e094f1087776a67dbbb8afea.zip
* sysdep.c (closedir): Don't free directory buffer if it looks
like it and the DIR were malloced together.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index e696cb3d352..2bbdf2640f2 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2927,7 +2927,11 @@ closedir (dirp)
2927 register DIR *dirp; /* stream from opendir */ 2927 register DIR *dirp; /* stream from opendir */
2928{ 2928{
2929 sys_close (dirp->dd_fd); 2929 sys_close (dirp->dd_fd);
2930 xfree ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */ 2930
2931 /* Some systems allocate the buffer and the DIR all in one block.
2932 Why in the world are we freeing this ourselves anyway? */
2933 if (dirp->dd_buf != (char *)(dirp + 1))
2934 xfree ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */
2931 xfree ((char *) dirp); 2935 xfree ((char *) dirp);
2932} 2936}
2933#endif /* not AIX */ 2937#endif /* not AIX */