diff options
| author | Thomas Reufer <thomas@reufer.ch> | 2015-01-17 16:12:38 +0100 |
|---|---|---|
| committer | Thomas Reufer <thomas@reufer.ch> | 2015-01-17 16:28:26 +0100 |
| commit | d7d4db47d260c0075edf14669af923d4e768338a (patch) | |
| tree | 2942d5563c6ed571c4c58325fc8e1ae848c4af9a | |
| parent | 69f2e196321ce155f61e7253c8abd2b0fcc6c94c (diff) | |
| download | vdr-plugin-rpihddevice-d7d4db47d260c0075edf14669af923d4e768338a.tar.gz vdr-plugin-rpihddevice-d7d4db47d260c0075edf14669af923d4e768338a.tar.bz2 | |
check return value when allocating bitmap memory
| -rw-r--r-- | ovgosd.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -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); |
