summaryrefslogtreecommitdiff
path: root/source3/smbd/files.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-05-24 11:22:11 +0200
committerStefan Metzmacher <metze@samba.org>2012-05-24 14:12:32 +0200
commit768004b11d396edfafaee90c7c710722376ff2e6 (patch)
tree5b7fe5efb79bae2115290066046df76d5278d657 /source3/smbd/files.c
parente33bf32ba3538032f95afbcd4b7e11c6ec6cb226 (diff)
downloadsamba-768004b11d396edfafaee90c7c710722376ff2e6.tar.gz
samba-768004b11d396edfafaee90c7c710722376ff2e6.tar.bz2
samba-768004b11d396edfafaee90c7c710722376ff2e6.zip
s3:smbd/files: fix error path and correctly cleanup
metze
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r--source3/smbd/files.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 203d0ad4c8..e357323f70 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -107,6 +107,11 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
fsp->fnum = i + FILE_HANDLE_OFFSET;
SMB_ASSERT(fsp->fnum < 65536);
+ DLIST_ADD(sconn->files, fsp);
+ sconn->num_files += 1;
+
+ conn->num_files_open++;
+
/*
* Create an smb_filename with "" for the base_name. There are very
* few NULL checks, so make sure it's initialized with something. to
@@ -115,13 +120,10 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
status = create_synthetic_smb_fname(fsp, "", NULL, NULL,
&fsp->fsp_name);
if (!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(fsp);
- TALLOC_FREE(fsp->fh);
+ file_free(NULL, fsp);
+ return status;
}
- DLIST_ADD(sconn->files, fsp);
- sconn->num_files += 1;
-
DEBUG(5,("allocated file structure %d, fnum = %d (%u used)\n",
i, fsp->fnum, (unsigned int)sconn->num_files));
@@ -136,8 +138,6 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
ZERO_STRUCT(sconn->fsp_fi_cache);
- conn->num_files_open++;
-
*result = fsp;
return NT_STATUS_OK;
}