summaryrefslogtreecommitdiff
path: root/core/src/fxge/ge/fx_ge_ps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxge/ge/fx_ge_ps.cpp')
-rw-r--r--core/src/fxge/ge/fx_ge_ps.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp
index e81b6bf362..ad572115c5 100644
--- a/core/src/fxge/ge/fx_ge_ps.cpp
+++ b/core/src/fxge/ge/fx_ge_ps.cpp
@@ -349,6 +349,9 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color,
int pitch = (width + 7) / 8;
FX_DWORD src_size = height * pitch;
FX_LPBYTE src_buf = FX_Alloc(FX_BYTE, src_size);
+ if (!src_buf) {
+ return FALSE;
+ }
for (int row = 0; row < height; row ++) {
FX_LPCBYTE src_scan = pSource->GetScanline(row);
FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch);
@@ -422,6 +425,13 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color,
int src_pitch = width * Bpp;
output_size = height * src_pitch;
output_buf = FX_Alloc(FX_BYTE, output_size);
+ if (!output_buf) {
+ if (pConverted != pSource) {
+ delete pConverted;
+ pConverted = NULL;
+ }
+ return FALSE;
+ }
for (int row = 0; row < height; row ++) {
FX_LPCBYTE src_scan = pConverted->GetScanline(row);
FX_LPBYTE dest_scan = output_buf + row * src_pitch;