From 6d8b1c2c7b1cbada20109f70ae971a4192330bb5 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 19 Jun 2015 17:26:17 -0700 Subject: Merge to XFA: Cleanup: Do not check pointers before deleting them. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1192743004. (cherry picked from commit cfac954abcab7caf47d3fa3d641c553cba998271) Review URL: https://codereview.chromium.org/1196783003. --- core/src/fxge/win32/fx_win32_dib.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'core/src/fxge/win32/fx_win32_dib.cpp') diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index a57b04688a..b6455c3570 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -142,9 +142,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) CFX_ByteString info = GetBitmapInfo(pDIBitmap); int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); if (!ret) { - if (pDIBitmap) { - delete pDIBitmap; - } + delete pDIBitmap; pDIBitmap = NULL; } DeleteDC(hDC); @@ -178,9 +176,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) CFX_ByteString info = GetBitmapInfo(pDIBitmap); int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); if (!ret) { - if (pDIBitmap) { - delete pDIBitmap; - } + delete pDIBitmap; pDIBitmap = NULL; } DeleteDC(hDC); @@ -255,9 +251,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP } } if (ret == 0) { - if (pDIBitmap) { - delete pDIBitmap; - } + delete pDIBitmap; pDIBitmap = NULL; } if (bCreatedDC) { -- cgit v1.2.3