diff options
author | Lei Zhang <thestig@chromium.org> | 2015-08-14 15:45:39 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-08-14 15:45:39 -0700 |
commit | cb62e7657b3a9a04142028a4e6614029a08e894b (patch) | |
tree | e7fa5f4c7d7f12bff9315475a89872fb044c36b1 /core/src/fxge/dib/fx_dib_convert.cpp | |
parent | 0f6b51c0fdd14f5762bf3c7412ac59c825443cc3 (diff) | |
download | pdfium-cb62e7657b3a9a04142028a4e6614029a08e894b.tar.xz |
Don't bother checking pointers before delete[] and FX_Free().
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1297713003 .
Diffstat (limited to 'core/src/fxge/dib/fx_dib_convert.cpp')
-rw-r--r-- | core/src/fxge/dib/fx_dib_convert.cpp | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index 74818f4a1b..4b50a0cdf3 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -202,36 +202,24 @@ CFX_Palette::CFX_Palette() { m_lut = 0; } CFX_Palette::~CFX_Palette() { - if (m_pPalette) { - FX_Free(m_pPalette); - } - if (m_cLut) { - FX_Free(m_cLut); - } - if (m_aLut) { - FX_Free(m_aLut); - } + FX_Free(m_pPalette); + FX_Free(m_cLut); + FX_Free(m_aLut); m_lut = 0; } FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) { if (pBitmap == NULL) { return FALSE; } - if (m_pPalette != NULL) { - FX_Free(m_pPalette); - } + FX_Free(m_pPalette); m_pPalette = FX_Alloc(FX_DWORD, 256); int bpp = pBitmap->GetBPP() / 8; int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); - if (m_cLut) { - FX_Free(m_cLut); - m_cLut = NULL; - } - if (m_aLut) { - FX_Free(m_aLut); - m_aLut = NULL; - } + FX_Free(m_cLut); + m_cLut = NULL; + FX_Free(m_aLut); + m_aLut = NULL; m_cLut = FX_Alloc(FX_DWORD, 4096); m_aLut = FX_Alloc(FX_DWORD, 4096); int row, col; @@ -1135,9 +1123,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, ret = ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(), m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform); if (!ret) { - if (pal_8bpp) { - FX_Free(pal_8bpp); - } + FX_Free(pal_8bpp); delete pClone; return NULL; } @@ -1215,24 +1201,18 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform); if (!ret) { - if (pal_8bpp) { - FX_Free(pal_8bpp); - } + FX_Free(pal_8bpp); if (pAlphaMask != m_pAlphaMask) { delete pAlphaMask; } - if (dest_buf) { - FX_Free(dest_buf); - } + FX_Free(dest_buf); return FALSE; } if (m_pAlphaMask && pAlphaMask != m_pAlphaMask) { delete m_pAlphaMask; } m_pAlphaMask = pAlphaMask; - if (m_pPalette) { - FX_Free(m_pPalette); - } + FX_Free(m_pPalette); m_pPalette = pal_8bpp; if (!m_bExtBuf) { FX_Free(m_pBuffer); |