summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-04-13 11:12:44 +0000
committerAndrew Tridgell <tridge@samba.org>1998-04-13 11:12:44 +0000
commite40b24249bf7aec81737e16081548bf99fa8cc76 (patch)
treec2c3df5dc450b5c15d49c5460b32a8548544b297
parentf724cdbcdf427d31be4435482c08e7a69cd9e35e (diff)
downloadsamba-e40b24249bf7aec81737e16081548bf99fa8cc76.tar.gz
samba-e40b24249bf7aec81737e16081548bf99fa8cc76.tar.bz2
samba-e40b24249bf7aec81737e16081548bf99fa8cc76.zip
fixed a memory leak in close_file(). Each time a file was opened
we leaked memory equal to the length of the filename. (This used to be commit 30a347de74f7f8e2646b1853a9e5914320cee58d)
-rw-r--r--source3/smbd/server.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index b86098f493..e0652d35c8 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1514,6 +1514,13 @@ void close_file(int fnum, BOOL normal_close)
DEBUG(2,("%s %s closed file %s (numopen=%d)\n",
timestring(),Connections[cnum].user,fs_p->name,
Connections[cnum].num_files_open));
+
+ if (fs_p->name) {
+ string_free(&fs_p->name);
+ }
+
+ /* we will catch bugs faster by zeroing this structure */
+ memset(fs_p, 0, sizeof(*fs_p));
}
enum {AFAIL,AREAD,AWRITE,AALL};
@@ -4949,7 +4956,6 @@ static void init_structs(void )
{
Files[i].open = False;
string_init(&Files[i].name,"");
-
}
for (i=0;i<MAX_OPEN_FILES;i++)