poppler/OptionalContent.cc |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 560b34a6e2d3fd58edfb5f0af751f1aa7d3dc3d8
Author: Adam Reichold <[email protected]>
Date:   Tue Sep 18 11:35:55 2018 +0200

    Prevent leaking OptionalContentGroup by using unique_ptr as early as 
possible. oss-fuzz/10418

diff --git a/poppler/OptionalContent.cc b/poppler/OptionalContent.cc
index 116b6ba9..717dc33d 100644
--- a/poppler/OptionalContent.cc
+++ b/poppler/OptionalContent.cc
@@ -54,16 +54,15 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) :
     if (!ocg.isDict()) {
       break;
     }
-    OptionalContentGroup *thisOptionalContentGroup = new 
OptionalContentGroup(ocg.getDict());
+    auto thisOptionalContentGroup = 
std::make_unique<OptionalContentGroup>(ocg.getDict());
     ocg = ocgList.arrayGetNF(i);
     if (!ocg.isRef()) {
-      delete thisOptionalContentGroup;
       break;
     }
     thisOptionalContentGroup->setRef( ocg.getRef() );
     // the default is ON - we change state later, depending on BaseState, ON 
and OFF
     thisOptionalContentGroup->setState(OptionalContentGroup::On);
-    optionalContentGroups.emplace(ocg.getRef(), thisOptionalContentGroup);
+    optionalContentGroups.emplace(ocg.getRef(), 
std::move(thisOptionalContentGroup));
   }
 
   Object defaultOcgConfig = ocgObject->dictLookup("D");
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to