From f3c9cf66d6a850b8225bc161722bed8aed440a2f Mon Sep 17 00:00:00 2001 From: Jun Fang Date: Mon, 11 Jan 2016 19:08:21 -0800 Subject: XFA: Fix memory leakage on Linux BUG=pdfium:348 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1579503002 . --- fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp | 1 + xfa/src/fgas/include/fx_utl.h | 1 + xfa/src/fgas/src/crt/fx_utils.cpp | 4 ++++ xfa/src/fxfa/src/app/xfa_ffapp.cpp | 1 + 4 files changed, 7 insertions(+) diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp index d623a68637..92d16b64e2 100644 --- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp @@ -65,6 +65,7 @@ CPDFXFA_Document::~CPDFXFA_Document() { CloseXFADoc(pDocHandler); } } + delete m_pXFADoc; } } diff --git a/xfa/src/fgas/include/fx_utl.h b/xfa/src/fgas/include/fx_utl.h index c58d5a1be6..f65aa994ea 100644 --- a/xfa/src/fgas/include/fx_utl.h +++ b/xfa/src/fgas/include/fx_utl.h @@ -46,6 +46,7 @@ class CFX_ThreadLock { class CFX_BaseArray : public CFX_Target { protected: CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize); + ~CFX_BaseArray(); int32_t GetSize() const; int32_t GetBlockSize() const; uint8_t* AddSpaceTo(int32_t index); diff --git a/xfa/src/fgas/src/crt/fx_utils.cpp b/xfa/src/fgas/src/crt/fx_utils.cpp index 7cc4de7022..e8be0d8d5f 100644 --- a/xfa/src/fgas/src/crt/fx_utils.cpp +++ b/xfa/src/fgas/src/crt/fx_utils.cpp @@ -36,6 +36,10 @@ CFX_BaseArray::CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize) { FXSYS_assert(iGrowSize > 0 && iBlockSize > 0); m_pData = new FX_BASEARRAYDATA(iGrowSize, iBlockSize); } +CFX_BaseArray::~CFX_BaseArray() { + RemoveAll(); + delete m_pData; +} int32_t CFX_BaseArray::GetSize() const { return m_pData->iBlockCount; } diff --git a/xfa/src/fxfa/src/app/xfa_ffapp.cpp b/xfa/src/fxfa/src/app/xfa_ffapp.cpp index fb37fb7ba3..8fb614b8a3 100644 --- a/xfa/src/fxfa/src/app/xfa_ffapp.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffapp.cpp @@ -92,6 +92,7 @@ CXFA_FFApp::~CXFA_FFApp() { if (m_pFWLApp) { m_pFWLApp->Finalize(); m_pFWLApp->Release(); + delete m_pFWLApp; } if (m_pFWLTheme) { m_pFWLTheme->Release(); -- cgit v1.2.3