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