summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Reufer <thomas@reufer.ch>2015-01-17 16:12:38 +0100
committerThomas Reufer <thomas@reufer.ch>2015-01-17 16:28:26 +0100
commitd7d4db47d260c0075edf14669af923d4e768338a (patch)
tree2942d5563c6ed571c4c58325fc8e1ae848c4af9a
parent69f2e196321ce155f61e7253c8abd2b0fcc6c94c (diff)
downloadvdr-plugin-rpihddevice-d7d4db47d260c0075edf14669af923d4e768338a.tar.gz
vdr-plugin-rpihddevice-d7d4db47d260c0075edf14669af923d4e768338a.tar.bz2
check return value when allocating bitmap memory
-rw-r--r--ovgosd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ovgosd.c b/ovgosd.c
index 58ae5cc..62a0271 100644
--- a/ovgosd.c
+++ b/ovgosd.c
@@ -1118,8 +1118,10 @@ public:
bool specialColors = ColorFg || ColorBg;
tColor *argb = (tColor*)malloc(Bitmap.Width() * Bitmap.Height() *
sizeof(tColor));
- tColor *p = argb;
+ if (!argb)
+ return;
+ tColor *p = argb;
for (int py = 0; py < Bitmap.Height(); py++)
for (int px = 0; px < Bitmap.Width(); px++)
{
@@ -1141,8 +1143,10 @@ public:
tColor *argb = (tColor*)malloc(Bitmap.Width() * Bitmap.Height() *
sizeof(tColor));
- tColor *p = argb;
+ if (!argb)
+ return;
+ tColor *p = argb;
for (int py = 0; py < Bitmap.Height(); py++)
for (int px = 0; px < Bitmap.Width(); px++)
*p++ = Bitmap.Color(*Bitmap.Data(px, py));
@@ -1198,6 +1202,9 @@ public:
{
unsigned int *symbols =
(unsigned int*)malloc((len + 1) * sizeof(unsigned int));
+ if (!symbols)
+ return;
+
Utf8ToArray(s, symbols, len + 1);
m_ovg->DoCmd(new cOvgCmdDrawText(x + Left(), y + Top(), symbols,
new cString(Font->FontName()), Font->Size(), ColorFg,
@@ -1273,8 +1280,10 @@ public:
int w = x2 - x1 + 1;
int h = y2 - y1 + 1;
tColor *argb = (tColor*)malloc(w * h * sizeof(tColor));
- tColor *p = argb;
+ if (!argb)
+ return;
+ tColor *p = argb;
for (int y = y1; y <= y2; ++y)
for (int x = x1; x <= x2; ++x)
*p++ = bitmap->GetColor(x, y);