fixed a memory leak (calling hash_table_init twice)
authorAndrew Tridgell <tridge@samba.org>
Tue, 2 May 2000 07:10:54 +0000 (07:10 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 2 May 2000 07:10:54 +0000 (07:10 +0000)
source/smbd/statcache.c

index ae5dbb1ef78fc34f38cd7c7f213b9abed8313a2d..e0ceddff1da82c94a18222692e3ad3fc5d23846e 100644 (file)
@@ -239,5 +239,11 @@ BOOL stat_cache_lookup(connection_struct *conn, char *name, char *dirpath,
  */
 BOOL reset_stat_cache( void )
 {
-  return hash_table_init( &stat_cache, INIT_STAT_CACHE_SIZE, (compare_function)(strcmp));
+       static BOOL initialised;
+       if (!initialised) {
+               initialised = True;
+               return hash_table_init( &stat_cache, INIT_STAT_CACHE_SIZE, (compare_function)(strcmp));
+       }
+       hash_clear(&stat_cache);
+       return True;
 } /* reset_stat_cache  */