summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2008-10-26 19:42:53 +0100
committerAlbert Astals Cid <aacid@kde.org>2008-11-09 20:56:23 +0100
commit70ada8a25a62e0b58d6db47c36b7ee32bbd9ddd7 (patch)
treeffa0b92bdb52cf5da5e6159809e321842900f8d7
parent8ee20b72cad944dea918365713f14a8d9fbf1ea0 (diff)
Fix memory leaks in OptionalContent
-rw-r--r--poppler/OptionalContent.cc13
-rw-r--r--poppler/OptionalContent.h10
2 files changed, 9 insertions, 14 deletions
diff --git a/poppler/OptionalContent.cc b/poppler/OptionalContent.cc
index 4a3d4a92..f59b16ad 100644
--- a/poppler/OptionalContent.cc
+++ b/poppler/OptionalContent.cc
@@ -28,7 +28,7 @@
//------------------------------------------------------------------------
OCGs::OCGs(Object *ocgObject, XRef *xref) :
- m_orderArray(0), m_rBGroupsArray(), m_xref(xref)
+ m_xref(xref)
{
// we need to parse the dictionary here, and build optionalContentGroups
ok = gTrue;
@@ -126,17 +126,8 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) :
}
off.free();
- Object order;
defaultOcgConfig.dictLookup("Order", &order);
- if ( (order.isArray()) && (order.arrayGetLength() > 0) ) {
- m_orderArray = order.getArray();
- }
-
- Object rbgroups;
defaultOcgConfig.dictLookup("RBGroups", &rbgroups);
- if ( (rbgroups.isArray()) && (rbgroups.arrayGetLength() > 0) ) {
- m_rBGroupsArray = rbgroups.getArray();
- }
ocgList.free();
defaultOcgConfig.free();
@@ -145,6 +136,8 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) :
OCGs::~OCGs()
{
deleteGooList(optionalContentGroups, OptionalContentGroup);
+ order.free();
+ rbgroups.free();
}
diff --git a/poppler/OptionalContent.h b/poppler/OptionalContent.h
index b6136c3d..90fded29 100644
--- a/poppler/OptionalContent.h
+++ b/poppler/OptionalContent.h
@@ -40,8 +40,10 @@ public:
OptionalContentGroup* findOcgByRef( const Ref &ref);
- Array* getOrderArray() const { return m_orderArray; }
- Array* getRBGroupsArray() const { return m_rBGroupsArray; }
+ Array* getOrderArray()
+ { return (order.isArray() && order.arrayGetLength() > 0) ? order.getArray() : NULL; }
+ Array* getRBGroupsArray()
+ { return (rbgroups.isArray() && rbgroups.arrayGetLength()) ? rbgroups.getArray() : NULL; }
bool optContentIsVisible( Object *dictRef );
@@ -55,8 +57,8 @@ private:
GooList *optionalContentGroups;
- Array *m_orderArray;
- Array *m_rBGroupsArray;
+ Object order;
+ Object rbgroups;
XRef *m_xref;
};