Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: core/src/fxge/ge/fx_ge_font.cpp

Issue 1145843005: Revert "Remove FX_Alloc() null checks now that it can't return NULL." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxge/dib/fx_dib_main.cpp ('k') | core/src/fxge/ge/fx_ge_fontmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/ge/fx_ge_font.cpp
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index 1896218cbf351d7dba4bc35a04bd3e3e210bb212..104a23998db4561cf3b73af245ec1b090c5c0bbe 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -104,6 +104,9 @@ extern "C" {
FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream)
{
FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(FX_BYTE, sizeof (FXFT_StreamRec));
+ if (!stream1) {
+ return FALSE;
+ }
stream1->base = NULL;
stream1->size = (unsigned long)pFile->GetSize();
stream1->pos = 0;
@@ -174,6 +177,9 @@ static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size)
FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size)
{
m_pFontDataAllocation = FX_Alloc(FX_BYTE, size);
+ if (!m_pFontDataAllocation) {
+ return FALSE;
+ }
FXSYS_memcpy32(m_pFontDataAllocation, data, size);
m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size);
m_pFontData = (FX_LPBYTE)m_pFontDataAllocation;
« no previous file with comments | « core/src/fxge/dib/fx_dib_main.cpp ('k') | core/src/fxge/ge/fx_ge_fontmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698