summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-05-06 17:48:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:27 -0500
commit309bbba38b82013f0a4e7e638d6ff3235f9966aa (patch)
treed6939b9af103ef010b3d953789e8d8ae8484e7dd /source3/libsmb
parentff343c516c02d4764935d0d38c8c87f8fc967780 (diff)
downloadsamba-309bbba38b82013f0a4e7e638d6ff3235f9966aa.tar.gz
samba-309bbba38b82013f0a4e7e638d6ff3235f9966aa.tar.bz2
samba-309bbba38b82013f0a4e7e638d6ff3235f9966aa.zip
r525: More memory leak fixes from kawasa_r@itg.hitachi.co.jp in error code
paths. Jeremy. (This used to be commit 88a97beac4f445f2a472167b3e5c0e8e1d019d17)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index e345dbe479..afbd2079ea 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -421,9 +421,7 @@ static BOOL cli_session_setup_nt1(struct cli_state *cli, const char *user,
end:
data_blob_free(&lm_response);
data_blob_free(&nt_response);
-
- if (!ret)
- data_blob_free(&session_key);
+ data_blob_free(&session_key);
return ret;
}
@@ -558,6 +556,7 @@ static ADS_STATUS cli_session_setup_kerberos(struct cli_state *cli, const char *
cli_set_session_key(cli, session_key_krb5);
data_blob_free(&negTokenTarg);
+ data_blob_free(&session_key_krb5);
if (cli_is_error(cli)) {
if (NT_STATUS_IS_OK(cli_nt_error(cli))) {
@@ -744,6 +743,8 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
* and do not store results */
if (got_kerberos_mechanism && cli->use_kerberos) {
+ ADS_STATUS rc;
+
if (pass && *pass) {
int ret;
@@ -751,16 +752,19 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
ret = kerberos_kinit_password(user, pass, 0 /* no time correction for now */, NULL);
if (ret){
+ SAFE_FREE(principal);
DEBUG(0, ("Kinit failed: %s\n", error_message(ret)));
return ADS_ERROR_KRB5(ret);
}
}
- return cli_session_setup_kerberos(cli, principal, domain);
+ rc = cli_session_setup_kerberos(cli, principal, domain);
+ SAFE_FREE(principal);
+ return rc;
}
#endif
- free(principal);
+ SAFE_FREE(principal);
ntlmssp: