summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-10-23 03:01:38 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-10-23 03:01:56 -0500
commit3fdd5c964ae9d1be5d17feef88a421771fe884cd (patch)
tree902b9f6519f100ff09fbd50a6e1e8362d37e8284
parent3991980d35f1711256e593cba6ff88064056f2a6 (diff)
downloadlibtdeldap-3fdd5c96.tar.gz
libtdeldap-3fdd5c96.zip
Fix memory leak on bind failure
Fix minor issues with comments
-rw-r--r--src/libtdeldap.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index 8a14cc3..8bb3c2a 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -407,12 +407,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);
+ }
}
}
@@ -765,7 +769,7 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
users.append(parseLDAPUserRecord(entry));
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
if (mretcode) *mretcode = 0;
@@ -843,7 +847,7 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
users.append(parseLDAPUserRecord(entry));
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
} while (morePages);
@@ -876,7 +880,7 @@ LDAPUserInfo LDAPManager::getUserByDistinguishedName(TQString dn) {
userinfo = parseLDAPUserRecord(entry);
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return userinfo;
@@ -907,7 +911,7 @@ LDAPGroupInfo LDAPManager::getGroupByDistinguishedName(TQString dn, TQString *er
groupinfo = parseLDAPGroupRecord(entry);
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return groupinfo;
@@ -2513,7 +2517,7 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
groups.append(parseLDAPGroupRecord(entry));
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
if (mretcode) *mretcode = 0;
@@ -2591,7 +2595,7 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
groups.append(parseLDAPGroupRecord(entry));
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
} while (morePages);
@@ -2634,7 +2638,7 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
machines.append(parseLDAPMachineRecord(entry));
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
if (mretcode) *mretcode = 0;
@@ -2712,7 +2716,7 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
machines.append(parseLDAPMachineRecord(entry));
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
} while (morePages);
@@ -2794,7 +2798,7 @@ LDAPServiceInfoList LDAPManager::machineServices(TQString machine_dn, int* mretc
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
if (mretcode) *mretcode = 0;
@@ -3088,7 +3092,7 @@ TQString LDAPManager::getRealmCAMaster(TQString* errstr) {
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return realmCAMaster;
@@ -3191,7 +3195,7 @@ int LDAPManager::getLdapCertificateStoreAttribute(TQString attribute, TQString*
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return returncode;
@@ -3272,7 +3276,7 @@ int LDAPManager::moveKerberosEntries(TQString newSuffix, TQString* errstr) {
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return 0;
@@ -3557,7 +3561,7 @@ LDAPTDEBuiltinsInfo LDAPManager::getTDEBuiltinMappings(TQString *errstr) {
builtininfo = parseLDAPTDEBuiltinsRecord(entry);
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return builtininfo;
@@ -3593,7 +3597,7 @@ LDAPMasterReplicationInfo LDAPManager::getLDAPMasterReplicationSettings(TQString
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
// Set OpenLDAP defaults
@@ -3612,7 +3616,7 @@ LDAPMasterReplicationInfo LDAPManager::getLDAPMasterReplicationSettings(TQString
replicationinfo = parseLDAPMasterReplicationRecord(replicationinfo, entry);
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return replicationinfo;
@@ -3938,7 +3942,7 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
if (!haveOlcOverlaySyncProv) {
@@ -3988,7 +3992,7 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
if (!haveOlcOverlaySyncProv) {
@@ -4097,7 +4101,7 @@ int LDAPManager::getTDECertificate(TQString certificateName, TQByteArray *certif
}
}
- // clean up
+ // Clean up
ldap_msgfree(msg);
return returncode;