mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
- Plugged memory leak default constructor
- Fixed copy-constructor
This commit is contained in:
parent
50a26bec0a
commit
5568abbbca
@ -22,8 +22,11 @@ LDAPEntry::LDAPEntry(const LDAPEntry& entry){
|
|||||||
LDAPEntry::LDAPEntry(const string& dn, const LDAPAttributeList *attrs){
|
LDAPEntry::LDAPEntry(const string& dn, const LDAPAttributeList *attrs){
|
||||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
|
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
|
||||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||||
" dn:" << dn << endl << " attrs:" << *attrs << endl);
|
" dn:" << dn << endl);
|
||||||
|
if ( attrs )
|
||||||
m_attrs=new LDAPAttributeList(*attrs);
|
m_attrs=new LDAPAttributeList(*attrs);
|
||||||
|
else
|
||||||
|
m_attrs=new LDAPAttributeList();
|
||||||
m_dn=dn;
|
m_dn=dn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +43,13 @@ LDAPEntry::~LDAPEntry(){
|
|||||||
delete m_attrs;
|
delete m_attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LDAPEntry& LDAPEntry::operator=(const LDAPEntry& from){
|
||||||
|
m_dn = from.m_dn;
|
||||||
|
delete m_attrs;
|
||||||
|
m_attrs = new LDAPAttributeList( *(from.m_attrs));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void LDAPEntry::setDN(const string& dn){
|
void LDAPEntry::setDN(const string& dn){
|
||||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setDN()" << endl);
|
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setDN()" << endl);
|
||||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
|
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
|
||||||
|
@ -30,7 +30,7 @@ class LDAPEntry{
|
|||||||
* @param attrs The attributes for the new entry.
|
* @param attrs The attributes for the new entry.
|
||||||
*/
|
*/
|
||||||
LDAPEntry(const std::string& dn=std::string(),
|
LDAPEntry(const std::string& dn=std::string(),
|
||||||
const LDAPAttributeList *attrs=new LDAPAttributeList());
|
const LDAPAttributeList *attrs=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used internally only.
|
* Used internally only.
|
||||||
@ -45,6 +45,11 @@ class LDAPEntry{
|
|||||||
*/
|
*/
|
||||||
~LDAPEntry();
|
~LDAPEntry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assingment operator
|
||||||
|
*/
|
||||||
|
LDAPEntry& operator=(const LDAPEntry& from);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the DN-attribute.
|
* Sets the DN-attribute.
|
||||||
* @param dn: The new DN for the entry.
|
* @param dn: The new DN for the entry.
|
||||||
|
Loading…
Reference in New Issue
Block a user