changeset 3760:e0be9df19ee1

* sysdep.c (closedir): Don't free directory buffer if it looks like it and the DIR were malloced together.
author Jim Blandy <jimb@redhat.com>
date Wed, 16 Jun 1993 20:31:01 +0000
parents 036367460955
children e9b348e99645
files src/sysdep.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/sysdep.c	Wed Jun 16 20:02:58 1993 +0000
+++ b/src/sysdep.c	Wed Jun 16 20:31:01 1993 +0000
@@ -2927,7 +2927,11 @@
      register DIR *dirp;              /* stream from opendir */
 {
   sys_close (dirp->dd_fd);
-  xfree ((char *) dirp->dd_buf);       /* directory block defined in <dirent.h> */
+
+  /* Some systems allocate the buffer and the DIR all in one block.
+     Why in the world are we freeing this ourselves anyway?  */
+  if (dirp->dd_buf != (char *)(dirp + 1))
+    xfree ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */
   xfree ((char *) dirp);
 }
 #endif /* not AIX */