summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-25 16:39:34 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-26 00:05:22 +0000
commit012ae898a069bda7afbfdad4eb4c8ba042b68dc7 (patch)
tree9a8e9e05e2fe6fd127b781dbb55b8793eea2d92e /core/fpdfapi/render
parent5c42c8e9b78082319ad57f143ad03037d447aa36 (diff)
downloadpdfium-012ae898a069bda7afbfdad4eb4c8ba042b68dc7.tar.xz
Get rid of a few |new|s in CPDF_Document.
The chain of destructors may attempt to use m_pDocPage after it has been set to null by the unique_ptr destructor. Verify it is still present before using it from any code that may be called from some other CPDF_ destructor. Change-Id: I007160231d73feed85d90efc687d6da993653f96 Reviewed-on: https://pdfium-review.googlesource.com/4499 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index e60d0329d0..3e00c8a23c 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -131,9 +131,11 @@ CPDF_DIBSource::~CPDF_DIBSource() {
FX_Free(m_pLineBuf);
m_pCachedBitmap.Reset(); // TODO(tsepez): determine if required early here.
FX_Free(m_pCompData);
- CPDF_ColorSpace* pCS = m_pColorSpace;
- if (pCS && m_pDocument)
- m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
+ if (m_pColorSpace && m_pDocument) {
+ auto* pPageData = m_pDocument->GetPageData();
+ if (pPageData)
+ pPageData->ReleaseColorSpace(m_pColorSpace->GetArray());
+ }
}
bool CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream) {