From: Jim Meyering Date: Thu, 1 Jan 1998 21:32:46 +0000 (+0000) Subject: (remove_cwd_entries): Initialize the entry-name obstack X-Git-Tag: FILEUTILS-3_16i~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3d19ee824cc289ccc59a6ad71aeee63652199c3;p=thirdparty%2Fcoreutils.git (remove_cwd_entries): Initialize the entry-name obstack only once and never free it. --- diff --git a/src/rm.c b/src/rm.c index 2da31aeb81..dbf1d42af4 100644 --- a/src/rm.c +++ b/src/rm.c @@ -529,11 +529,16 @@ remove_cwd_entries (void) struct HT *ht = NULL; /* FIXME: describe */ - struct obstack entry_name_pool; + static struct obstack entry_name_pool; + static int first_call = 1; enum RM_status status = RM_OK; - obstack_init (&entry_name_pool); + if (first_call) + { + first_call = 0; + obstack_init (&entry_name_pool); + } if (dirp) { @@ -674,7 +679,8 @@ remove_cwd_entries (void) hash_free (ht); } - obstack_free (&entry_name_pool, NULL); + if (obstack_object_size (&entry_name_pool) > 0) + obstack_free (&entry_name_pool, obstack_base (&entry_name_pool)); return status; }