Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: core/include/fpdfapi/fpdf_objects.h

Issue 1514093002: Fix memory leaks involving InsertIndirectObject() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
8 #define CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 8 #define CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
9 9
10 #include <set> 10 #include <set>
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 ~CPDF_IndirectObjects(); 604 ~CPDF_IndirectObjects();
605 605
606 CPDF_Object* GetIndirectObject(FX_DWORD objnum, 606 CPDF_Object* GetIndirectObject(FX_DWORD objnum,
607 struct PARSE_CONTEXT* pContext = NULL); 607 struct PARSE_CONTEXT* pContext = NULL);
608 608
609 int GetIndirectType(FX_DWORD objnum); 609 int GetIndirectType(FX_DWORD objnum);
610 610
611 FX_DWORD AddIndirectObject(CPDF_Object* pObj); 611 FX_DWORD AddIndirectObject(CPDF_Object* pObj);
612 612
613 void ReleaseIndirectObject(FX_DWORD objnum); 613 void ReleaseIndirectObject(FX_DWORD objnum);
614 614 // Takes ownership of |pObj|.
615 void InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj); 615 FX_BOOL InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj);
616 616
617 FX_DWORD GetLastObjNum() const; 617 FX_DWORD GetLastObjNum() const;
618 618
619 FX_POSITION GetStartPosition() const { 619 FX_POSITION GetStartPosition() const {
620 return m_IndirectObjs.GetStartPosition(); 620 return m_IndirectObjs.GetStartPosition();
621 } 621 }
622 622
623 void GetNextAssoc(FX_POSITION& rPos, 623 void GetNextAssoc(FX_POSITION& rPos,
624 FX_DWORD& objnum, 624 FX_DWORD& objnum,
625 CPDF_Object*& pObject) const { 625 CPDF_Object*& pObject) const {
626 m_IndirectObjs.GetNextAssoc(rPos, (void*&)objnum, (void*&)pObject); 626 m_IndirectObjs.GetNextAssoc(rPos, (void*&)objnum, (void*&)pObject);
627 } 627 }
628 628
629 protected: 629 protected:
630 CFX_MapPtrToPtr m_IndirectObjs; 630 CFX_MapPtrToPtr m_IndirectObjs;
631 631
632 CPDF_Parser* m_pParser; 632 CPDF_Parser* m_pParser;
633 633
634 FX_DWORD m_LastObjNum; 634 FX_DWORD m_LastObjNum;
635 }; 635 };
636 636
637 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 637 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698