summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-20 08:43:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:39 -0500
commita8716afce8819a6dd8e73b34c513f7f512b274d6 (patch)
tree9d4d68303adcb0bddeca819af3a046f4f86d65d2 /source4
parente3036006fe99893eb6c4f69ca2e70e48d35e8f24 (diff)
downloadsamba-a8716afce8819a6dd8e73b34c513f7f512b274d6.tar.gz
samba-a8716afce8819a6dd8e73b34c513f7f512b274d6.tar.bz2
samba-a8716afce8819a6dd8e73b34c513f7f512b274d6.zip
r23018: fixed a memory leak in our server side session setup code for failed
session setups (This used to be commit a4e043e1f8f3cf1ab86e6dde501722b8050bbde4)
Diffstat (limited to 'source4')
-rw-r--r--source4/smb_server/smb/sesssetup.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source4/smb_server/smb/sesssetup.c b/source4/smb_server/smb/sesssetup.c
index b6bddaa5b1..56d9e64e31 100644
--- a/source4/smb_server/smb/sesssetup.c
+++ b/source4/smb_server/smb/sesssetup.c
@@ -60,7 +60,7 @@ static void sesssetup_old_send(struct auth_check_password_request *areq,
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 @@ static void sesssetup_old_send(struct auth_check_password_request *areq,
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 @@ static void sesssetup_nt1_send(struct auth_check_password_request *areq,
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 @@ static void sesssetup_nt1_send(struct auth_check_password_request *areq,
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 @@ static void sesssetup_spnego_send(struct gensec_update_request *greq, void *priv
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);
}