summaryrefslogtreecommitdiffstats
path: root/daemons
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-11-20 20:50:11 -0500
committerSimo Sorce <ssorce@redhat.com>2011-12-02 09:49:30 -0500
commitc3dc08b93ffc3c98cef16200752ca2d3badeccd1 (patch)
treec5331d3c180eb3259591a4d9759b460f3efce381 /daemons
parent64dfa1b37e0fb631400ae9d6a12fbe84add6a85f (diff)
downloadfreeipa-c3dc08b93ffc3c98cef16200752ca2d3badeccd1.tar.gz
freeipa-c3dc08b93ffc3c98cef16200752ca2d3badeccd1.tar.xz
freeipa-c3dc08b93ffc3c98cef16200752ca2d3badeccd1.zip
ipa-kdb: fix memleaks in ipa_kdb_mspac.c
Diffstat (limited to 'daemons')
-rw-r--r--daemons/ipa-kdb/ipa_kdb_mspac.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/daemons/ipa-kdb/ipa_kdb_mspac.c b/daemons/ipa-kdb/ipa_kdb_mspac.c
index cce1ca906..b435efeec 100644
--- a/daemons/ipa-kdb/ipa_kdb_mspac.c
+++ b/daemons/ipa-kdb/ipa_kdb_mspac.c
@@ -466,7 +466,7 @@ static krb5_error_code ipadb_get_pac(krb5_context kcontext,
TALLOC_CTX *tmpctx;
struct ipadb_e_data *ied;
struct ipadb_context *ipactx;
- LDAPMessage *results;
+ LDAPMessage *results = NULL;
LDAPMessage *lentry;
DATA_BLOB pac_data;
krb5_data data;
@@ -479,11 +479,6 @@ static krb5_error_code ipadb_get_pac(krb5_context kcontext,
return KRB5_KDB_DBNOTINITED;
}
- tmpctx = talloc_new(NULL);
- if (!tmpctx) {
- return ENOMEM;
- }
-
ied = (struct ipadb_e_data *)client->e_data;
if (ied->magic != IPA_E_DATA_MAGIC) {
return EINVAL;
@@ -493,9 +488,14 @@ static krb5_error_code ipadb_get_pac(krb5_context kcontext,
return 0;
}
+ tmpctx = talloc_new(NULL);
+ if (!tmpctx) {
+ return ENOMEM;
+ }
+
memset(&pac_info, 0, sizeof(pac_info));
pac_info.logon_info.info = talloc_zero(tmpctx, struct PAC_LOGON_INFO);
- if (!tmpctx) {
+ if (!pac_info.logon_info.info) {
kerr = ENOMEM;
goto done;
}
@@ -542,6 +542,7 @@ static krb5_error_code ipadb_get_pac(krb5_context kcontext,
kerr = krb5_pac_add_buffer(kcontext, *pac, KRB5_PAC_LOGON_INFO, &data);
done:
+ ldap_msgfree(results);
talloc_free(tmpctx);
return kerr;
}