summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-10-23 03:01:38 -0500
committerSlávek Banko <slavek.banko@axis.cz>2015-10-24 01:01:40 +0200
commitf746c03828d00781843af45584ef15fe5d1442c3 (patch)
tree38f75f0f7c07d089a0edec48f86446dc388c91d0
parentba81541fe513cd6ee0895dc1567a31cd78bc1cd0 (diff)
downloadlibtdeldap-f746c03828d00781843af45584ef15fe5d1442c3.tar.gz
libtdeldap-f746c03828d00781843af45584ef15fe5d1442c3.zip
Fix memory leak on bind failurer14.0.3r14.0.2
Fix minor issues with comments (cherry picked from commit 3fdd5c964ae9d1be5d17feef88a421771fe884cd)
-rw-r--r--src/libtdeldap.cpp60
1 files changed, 32 insertions, 28 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index 11b0150..1e2678c 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -317,12 +317,16 @@ int LDAPManager::bind(TQString* errstr) {
}
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
// All done!
ldap_unbind_ext_s(ldapconn, NULL, NULL);
}
+ else {
+ // Clean up
+ ldap_unbind_ext_s(ldapconn, NULL, NULL);
+ }
}
}
@@ -654,8 +658,8 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
users.append(parseLDAPUserRecord(entry));
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
if (mretcode) *mretcode = 0;
@@ -732,8 +736,8 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
users.append(parseLDAPUserRecord(entry));
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
} while (morePages);
@@ -765,8 +769,8 @@ LDAPUserInfo LDAPManager::getUserByDistinguishedName(TQString dn) {
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
userinfo = parseLDAPUserRecord(entry);
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
return userinfo;
@@ -796,8 +800,8 @@ LDAPGroupInfo LDAPManager::getGroupByDistinguishedName(TQString dn, TQString *er
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
groupinfo = parseLDAPGroupRecord(entry);
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
return groupinfo;
@@ -2204,8 +2208,8 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
groups.append(parseLDAPGroupRecord(entry));
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
if (mretcode) *mretcode = 0;
@@ -2282,8 +2286,8 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
groups.append(parseLDAPGroupRecord(entry));
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
} while (morePages);
@@ -2325,8 +2329,8 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
machines.append(parseLDAPMachineRecord(entry));
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
if (mretcode) *mretcode = 0;
@@ -2403,8 +2407,8 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
machines.append(parseLDAPMachineRecord(entry));
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
} while (morePages);
@@ -2486,7 +2490,7 @@ LDAPServiceInfoList LDAPManager::machineServices(TQString machine_dn, int* mretc
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
if (mretcode) *mretcode = 0;
@@ -2684,7 +2688,7 @@ TQString LDAPManager::getRealmCAMaster(TQString* errstr) {
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return realmCAMaster;
@@ -2763,7 +2767,7 @@ int LDAPManager::moveKerberosEntries(TQString newSuffix, TQString* errstr) {
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return 0;
@@ -3048,7 +3052,7 @@ LDAPTDEBuiltinsInfo LDAPManager::getTDEBuiltinMappings(TQString *errstr) {
builtininfo = parseLDAPTDEBuiltinsRecord(entry);
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return builtininfo;
@@ -3084,7 +3088,7 @@ LDAPMasterReplicationInfo LDAPManager::getLDAPMasterReplicationSettings(TQString
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
// Set OpenLDAP defaults
@@ -3103,7 +3107,7 @@ LDAPMasterReplicationInfo LDAPManager::getLDAPMasterReplicationSettings(TQString
replicationinfo = parseLDAPMasterReplicationRecord(replicationinfo, entry);
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return replicationinfo;
@@ -3428,8 +3432,8 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
haveOlcOverlaySyncProv = true;
}
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
if (!haveOlcOverlaySyncProv) {
@@ -3478,8 +3482,8 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
haveOlcOverlaySyncProv = true;
}
}
-
- // clean up
+
+ // Clean up
ldap_msgfree(msg);
if (!haveOlcOverlaySyncProv) {
@@ -3591,7 +3595,7 @@ int LDAPManager::getTDECertificate(TQString certificateName, TQString fileName,
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return returncode;