Fixed memory leaks.
This commit is contained in:
parent
68e51fe262
commit
bdfcfed13a
@ -47,6 +47,8 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
~IMAPpart();
|
||||
|
||||
const structure& getStructure() const;
|
||||
structure& getStructure();
|
||||
|
||||
@ -125,6 +127,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
~IMAPstructure()
|
||||
{
|
||||
free_container(m_parts);
|
||||
}
|
||||
|
||||
|
||||
const part& operator[](const int x) const
|
||||
{
|
||||
@ -199,6 +206,13 @@ IMAPpart::IMAPpart(IMAPpart* parent, const int number, const IMAPParser::body_ty
|
||||
}
|
||||
|
||||
|
||||
IMAPpart::~IMAPpart()
|
||||
{
|
||||
delete (m_structure);
|
||||
delete (m_header);
|
||||
}
|
||||
|
||||
|
||||
const class structure& IMAPpart::getStructure() const
|
||||
{
|
||||
if (m_structure != NULL)
|
||||
|
@ -40,6 +40,7 @@ class maildirPart : public part
|
||||
public:
|
||||
|
||||
maildirPart(maildirPart* parent, const int number, const bodyPart& part);
|
||||
~maildirPart();
|
||||
|
||||
|
||||
const structure& getStructure() const;
|
||||
@ -119,6 +120,11 @@ public:
|
||||
m_parts.push_back(new maildirPart(parent, number, *list[i]));
|
||||
}
|
||||
|
||||
~maildirStructure()
|
||||
{
|
||||
free_container(m_parts);
|
||||
}
|
||||
|
||||
|
||||
const part& operator[](const int x) const
|
||||
{
|
||||
@ -154,8 +160,11 @@ maildirStructure maildirStructure::m_emptyStructure;
|
||||
|
||||
|
||||
maildirPart::maildirPart(maildirPart* parent, const int number, const bodyPart& part)
|
||||
: m_parent(parent), m_number(number)
|
||||
: m_parent(parent), m_header(NULL), m_number(number)
|
||||
{
|
||||
if (part.getBody()->getPartList().size() == 0)
|
||||
m_structure = NULL;
|
||||
else
|
||||
m_structure = new maildirStructure(this, part.getBody()->getPartList());
|
||||
|
||||
m_headerParsedOffset = part.getHeader()->getParsedOffset();
|
||||
@ -170,15 +179,28 @@ maildirPart::maildirPart(maildirPart* parent, const int number, const bodyPart&
|
||||
}
|
||||
|
||||
|
||||
maildirPart::~maildirPart()
|
||||
{
|
||||
delete (m_structure);
|
||||
delete (m_header);
|
||||
}
|
||||
|
||||
|
||||
const structure& maildirPart::getStructure() const
|
||||
{
|
||||
if (m_structure != NULL)
|
||||
return (*m_structure);
|
||||
else
|
||||
return (*maildirStructure::emptyStructure());
|
||||
}
|
||||
|
||||
|
||||
structure& maildirPart::getStructure()
|
||||
{
|
||||
if (m_structure != NULL)
|
||||
return (*m_structure);
|
||||
else
|
||||
return (*maildirStructure::emptyStructure());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user