summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-kdb
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-11-03 13:21:59 -0400
committerSimo Sorce <ssorce@redhat.com>2011-11-07 11:13:55 -0500
commit299c91df9284510a131017c7fb44f555f2e2afc3 (patch)
treeee9c11b56ebcfbcbb725ff4de03ebae26d3ffe46 /daemons/ipa-kdb
parent8276d5d55fb0de218ddd8edd02a1fde56b299eb6 (diff)
downloadfreeipa-299c91df9284510a131017c7fb44f555f2e2afc3.tar.gz
freeipa-299c91df9284510a131017c7fb44f555f2e2afc3.tar.xz
freeipa-299c91df9284510a131017c7fb44f555f2e2afc3.zip
Fix CID 11019: Resource leak
https://fedorahosted.org/freeipa/ticket/2037
Diffstat (limited to 'daemons/ipa-kdb')
-rw-r--r--daemons/ipa-kdb/ipa_kdb.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/daemons/ipa-kdb/ipa_kdb.c b/daemons/ipa-kdb/ipa_kdb.c
index 6a6c20639..481b1f392 100644
--- a/daemons/ipa-kdb/ipa_kdb.c
+++ b/daemons/ipa-kdb/ipa_kdb.c
@@ -263,6 +263,13 @@ int ipadb_get_connection(struct ipadb_context *ipactx)
done:
ldap_msgfree(res);
+
+ ldap_value_free_len(vals);
+ for (i = 0; i < c && cvals[i]; i++) {
+ free(cvals[i]);
+ }
+ free(cvals);
+
if (ret) {
if (ipactx->lcontext) {
ldap_unbind_ext_s(ipactx->lcontext, NULL, NULL);
@@ -274,12 +281,6 @@ done:
return EIO;
}
- ldap_value_free_len(vals);
- for (i = 0; i < c; i++) {
- free(cvals[i]);
- }
- free(cvals);
-
return 0;
}