From e40b24249bf7aec81737e16081548bf99fa8cc76 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Apr 1998 11:12:44 +0000 Subject: 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) --- source3/smbd/server.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source3/smbd') 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