diff options
author | Lei Zhang <thestig@chromium.org> | 2015-08-14 22:22:13 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-08-14 22:22:13 -0700 |
commit | da180e9fdd4385df024cc18046f62ca47bc74d74 (patch) | |
tree | 931e0e64ac2cbc82e3718e43418ee6bd676da4a5 /core/src/fxge/dib/fx_dib_main.cpp | |
parent | 2b1a2d528469cda4e9f3e36d3c7a649e0d476480 (diff) | |
download | pdfium-da180e9fdd4385df024cc18046f62ca47bc74d74.tar.xz |
Merge to XFA: Don't bother checking pointers before delete[] and FX_Free().
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1297713003 .
(cherry picked from commit cb62e7657b3a9a04142028a4e6614029a08e894b)
Review URL: https://codereview.chromium.org/1287053005 .
Diffstat (limited to 'core/src/fxge/dib/fx_dib_main.cpp')
-rw-r--r-- | core/src/fxge/dib/fx_dib_main.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index ce55640cb3..f3e3a23236 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -48,9 +48,7 @@ CFX_DIBSource::CFX_DIBSource() { m_pAlphaMask = NULL; } CFX_DIBSource::~CFX_DIBSource() { - if (m_pPalette) { - FX_Free(m_pPalette); - } + FX_Free(m_pPalette); delete m_pAlphaMask; } CFX_DIBitmap::CFX_DIBitmap() { @@ -102,7 +100,7 @@ FX_BOOL CFX_DIBitmap::Create(int width, FX_BOOL ret = TRUE; ret = BuildAlphaMask(); if (!ret) { - if (!m_bExtBuf && m_pBuffer) { + if (!m_bExtBuf) { FX_Free(m_pBuffer); m_pBuffer = NULL; m_Width = m_Height = m_Pitch = 0; @@ -127,18 +125,16 @@ FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) { return TRUE; } CFX_DIBitmap::~CFX_DIBitmap() { - if (m_pBuffer && !m_bExtBuf) { + if (!m_bExtBuf) { FX_Free(m_pBuffer); } m_pBuffer = NULL; } void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap) { - if (m_pBuffer && !m_bExtBuf) { + if (!m_bExtBuf) { FX_Free(m_pBuffer); } - if (m_pPalette) { - FX_Free(m_pPalette); - } + FX_Free(m_pPalette); delete m_pAlphaMask; m_pBuffer = pSrcBitmap->m_pBuffer; m_pPalette = pSrcBitmap->m_pPalette; @@ -548,9 +544,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, } void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size) { if (pSrc == NULL || GetBPP() > 8) { - if (m_pPalette) { - FX_Free(m_pPalette); - } + FX_Free(m_pPalette); m_pPalette = NULL; } else { FX_DWORD pal_size = 1 << GetBPP(); @@ -1546,9 +1540,7 @@ CFX_FilteredDIB::~CFX_FilteredDIB() { if (m_bAutoDropSrc) { delete m_pSrc; } - if (m_pScanline) { - FX_Free(m_pScanline); - } + FX_Free(m_pScanline); } void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) { m_pSrc = pSrc; |