summaryrefslogtreecommitdiff
path: root/source3/smbd/files.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-06-08 21:20:07 -0700
committerJeremy Allison <jra@samba.org>2010-06-08 21:20:07 -0700
commit34a8324409961c4837e83c714fb1a285f238312d (patch)
treed6372f70e6fdd55728e52c58e71c83820a727b71 /source3/smbd/files.c
parent0c5d0e1c37daf5b802e990bde8469934ae33f6cc (diff)
downloadsamba-34a8324409961c4837e83c714fb1a285f238312d.tar.gz
samba-34a8324409961c4837e83c714fb1a285f238312d.tar.bz2
samba-34a8324409961c4837e83c714fb1a285f238312d.zip
Fix a valgrind error found by SMB2-COMPOUND test.
If a file is closed we must also NULL out all chained_fsp pointers when the fsp is freed to prevent invalid pointer access. Jeremy.
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r--source3/smbd/files.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 43956e3903..7ad5ce3ae6 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -503,6 +503,14 @@ void file_free(struct smb_request *req, files_struct *fsp)
req->chain_fsp = NULL;
}
+ /*
+ * Clear all possible chained fsp
+ * pointers in the SMB2 request queue.
+ */
+ if (req != NULL && req->smb2req) {
+ remove_smb2_chained_fsp(fsp);
+ }
+
/* Closing a file can invalidate the positive cache. */
if (fsp == fsp_fi_cache.fsp) {
ZERO_STRUCT(fsp_fi_cache);