]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(remove_cwd_entries): Plug a gross leak -- don't call
authorJim Meyering <jim@meyering.net>
Mon, 29 Dec 1997 21:04:26 +0000 (21:04 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 29 Dec 1997 21:04:26 +0000 (21:04 +0000)
obstack_init inside the loop.

src/rm.c

index 476a0ab3e498fe74155925f2ce878050c883a003..2da31aeb81ec4c0c6ce8e4ee94ba1db9a58afea7 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -533,6 +533,8 @@ remove_cwd_entries (void)
 
   enum RM_status status = RM_OK;
 
+  obstack_init (&entry_name_pool);
+
   if (dirp)
     {
       if (CLOSEDIR (dirp))
@@ -567,8 +569,6 @@ remove_cwd_entries (void)
          enum RM_status tmp_status;
          struct dirent *dp;
 
-         obstack_init (&entry_name_pool);
-
 /* FILE should be skipped if it is `.' or `..', or if it is in
    the table, HT, of entries we've already processed.  */
 #define SKIPPABLE(Ht, File) (DOT_OR_DOTDOT(File) \
@@ -593,8 +593,7 @@ remove_cwd_entries (void)
 
          dp = readdir (dirp);
 
-/* FIXME: add autoconf test to detect this.  */
-#ifndef HAVE_WORKING_READDIR
+#if ! HAVE_WORKING_READDIR
          if (dp == NULL)
            {
              /* Since we have probably modified the directory since it