mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3:smbd/files: fix error path and correctly cleanup
metze
This commit is contained in:
parent
e33bf32ba3
commit
768004b11d
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user