Author: tridge Date: 2007-05-20 08:43:03 +0000 (Sun, 20 May 2007) New Revision: 23018
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23018 Log: fixed a memory leak in our server side session setup code for failed session setups Modified: branches/SAMBA_4_0/source/smb_server/smb/sesssetup.c Changeset: Modified: branches/SAMBA_4_0/source/smb_server/smb/sesssetup.c =================================================================== --- branches/SAMBA_4_0/source/smb_server/smb/sesssetup.c 2007-05-20 08:01:02 UTC (rev 23017) +++ branches/SAMBA_4_0/source/smb_server/smb/sesssetup.c 2007-05-20 08:43:03 UTC (rev 23018) @@ -60,7 +60,7 @@ union smb_sesssetup *sess = talloc_get_type(req->io_ptr, union smb_sesssetup); struct auth_serversupplied_info *server_info = NULL; struct auth_session_info *session_info; - struct smbsrv_session *smb_sess; + struct smbsrv_session *smb_sess = NULL; NTSTATUS status; status = auth_check_password_recv(areq, req, &server_info); @@ -88,6 +88,10 @@ sess->old.out.vuid = smb_sess->vuid; failed: + if (!NT_STATUS_IS_OK(status)) { + talloc_free(smb_sess); + req->session = NULL; + } status = auth_nt_status_squash(status); smbsrv_sesssetup_backend_send(req, sess, status); } @@ -155,7 +159,7 @@ union smb_sesssetup *sess = talloc_get_type(req->io_ptr, union smb_sesssetup); struct auth_serversupplied_info *server_info = NULL; struct auth_session_info *session_info; - struct smbsrv_session *smb_sess; + struct smbsrv_session *smb_sess = NULL; NTSTATUS status; status = auth_check_password_recv(areq, req, &server_info); @@ -204,6 +208,10 @@ done: status = NT_STATUS_OK; failed: + if (!NT_STATUS_IS_OK(status)) { + talloc_free(smb_sess); + req->session = NULL; + } status = auth_nt_status_squash(status); smbsrv_sesssetup_backend_send(req, sess, status); } @@ -337,6 +345,10 @@ done: sess->spnego.out.vuid = smb_sess->vuid; failed: + if (!NT_STATUS_IS_OK(status)) { + talloc_free(smb_sess); + req->session = NULL; + } status = auth_nt_status_squash(status); smbsrv_sesssetup_backend_send(req, sess, status); }