s3: Close the now opened file descriptor in error paths
authorVolker Lendecke <vl@samba.org>
Wed, 26 Sep 2012 20:20:57 +0000 (22:20 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 29 Sep 2012 15:42:50 +0000 (08:42 -0700)
source3/smbd/open.c

index 8fe87d5a5118e11054ee5e01f42ee2e125f52408..b4eeeca5955ca451d5f769488b983cd9a705639e 100644 (file)
@@ -2348,6 +2348,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
        if (NT_STATUS_EQUAL(status, NT_STATUS_DELETE_PENDING)) {
                /* DELETE_PENDING is not deferred for a second */
                TALLOC_FREE(lck);
        if (NT_STATUS_EQUAL(status, NT_STATUS_DELETE_PENDING)) {
                /* DELETE_PENDING is not deferred for a second */
                TALLOC_FREE(lck);
+               fd_close(fsp);
                return status;
        }
 
                return status;
        }
 
@@ -2366,6 +2367,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                                DEBUG(0, ("DOS open without an SMB "
                                          "request!\n"));
                                TALLOC_FREE(lck);
                                DEBUG(0, ("DOS open without an SMB "
                                          "request!\n"));
                                TALLOC_FREE(lck);
+                               fd_close(fsp);
                                return NT_STATUS_INTERNAL_ERROR;
                        }
 
                                return NT_STATUS_INTERNAL_ERROR;
                        }
 
@@ -2463,6 +2465,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                }
 
                TALLOC_FREE(lck);
                }
 
                TALLOC_FREE(lck);
+               fd_close(fsp);
                if (can_access) {
                        /*
                         * We have detected a sharing violation here
                if (can_access) {
                        /*
                         * We have detected a sharing violation here