Commit 560b34a6 authored by Adam Reichold's avatar Adam Reichold Committed by Albert Astals Cid

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

parent 7ac84c1d
Pipeline #4485 passed with stage
in 2 minutes and 25 seconds
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment