Index: fpdfsdk/src/fpdfview.cpp |
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp |
index 3207ebe336000ca0afd373fb31af1e5b83e0c872..3c0e010465d1cc27a1aca6223a3109fa87aa3f09 100644 |
--- a/fpdfsdk/src/fpdfview.cpp |
+++ b/fpdfsdk/src/fpdfview.cpp |
@@ -11,6 +11,7 @@ |
#include "../include/fpdf_progressive.h" |
#include "../include/fpdf_ext.h" |
#include "../../../core/src/fxcrt/fx_safe_types.h" |
+#include "../../third_party/base/nonstd_unique_ptr.h" |
#include "../../third_party/base/numerics/safe_conversions_impl.h" |
CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) |
@@ -597,9 +598,11 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, int start_x, int start_ |
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha) |
{ |
- CFX_DIBitmap* pBitmap = new CFX_DIBitmap; |
- pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32); |
- return pBitmap; |
+ nonstd::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap); |
+ if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32)) { |
+ return NULL; |
+ } |
+ return pBitmap.release(); |
} |
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int format, void* first_scan, int stride) |