• R/O
  • SSH
  • HTTPS

opfc: Commit


Commit MetaInfo

Revision911 (tree)
Zeit2011-06-07 11:54:02
Autorsho-otani

Log Message

Fixed memory leak in XObjects

Ändern Zusammenfassung

Diff

--- pdftopdf/trunk/src/P2PFont.cc (revision 910)
+++ pdftopdf/trunk/src/P2PFont.cc (revision 911)
@@ -904,12 +904,12 @@
904904 xref->fetch(num,gen,&descendant);
905905 }
906906 }
907- if (!descendant.isDict()) {
908- error(-1,const_cast<char *>("Font:%s has illegal DescendantFonts entry.\n"),name);
909- goto end_read1;
910- }
911- doReadFontDescriptor(&descendant,type,name,xref);
912907 if (cidFontDict == 0) {
908+ if (!descendant.isDict()) {
909+ error(-1,const_cast<char *>("Font:%s has illegal DescendantFonts entry.\n"),name);
910+ goto end_read1;
911+ }
912+ doReadFontDescriptor(&descendant,type,name,xref);
913913 cidFontDict = new P2PCIDFontDict(&descendant,font,type,
914914 embeddedType,fontDescriptor,num,gen);
915915 if (num > 0) P2PXRef::put(cidFontDict);
--- pdftopdf/trunk/src/P2PResources.cc (revision 910)
+++ pdftopdf/trunk/src/P2PResources.cc (revision 911)
@@ -179,13 +179,24 @@
179179 P2PForm *form;
180180
181181 xobjDict->getVal(i,&xobj);
182- if (!xobj.isStream()) continue;
182+ if (!xobj.isStream()) {
183+ xobj.free();
184+ continue;
185+ }
183186 strDict = xobj.streamGetDict();
184187 strDict->lookupNF("Subtype",&obj);
185- if (!obj.isName() || strcmp("Form",obj.getName()) != 0) continue;
188+ if (!obj.isName() || strcmp("Form",obj.getName()) != 0) {
189+ obj.free();
190+ xobj.free();
191+ continue;
192+ }
186193 obj.free();
187194 strDict->lookupNF("Resources",&obj);
188- if (!obj.isNull()) continue;
195+ if (!obj.isNull()) {
196+ obj.free();
197+ xobj.free();
198+ continue;
199+ }
189200 /* found a Form without Resource,
190201 replace it with a refrence to a P2PForm */
191202 form = new P2PForm(&xobj,this,map);
Show on old repository browser