aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/image/vectorimagerenderer.cpp
diff options
context:
space:
mode:
authorJulien2011-06-04 06:05:01 +0800
committerJulien2011-06-23 15:15:57 +0800
commite972c6cfd87cb5cbf1e93cf481f53add88655c42 (patch)
tree809b15141a2b8c239b8e93419e7244bfd80f2233 /engines/sword25/gfx/image/vectorimagerenderer.cpp
parent53c4a190fc2337b6f2bec943ca9016f89d8e6f2f (diff)
downloadscummvm-rg350-e972c6cfd87cb5cbf1e93cf481f53add88655c42.tar.gz
scummvm-rg350-e972c6cfd87cb5cbf1e93cf481f53add88655c42.tar.bz2
scummvm-rg350-e972c6cfd87cb5cbf1e93cf481f53add88655c42.zip
SWORD25: Add error checks after allocating memory with malloc
Diffstat (limited to 'engines/sword25/gfx/image/vectorimagerenderer.cpp')
-rw-r--r--engines/sword25/gfx/image/vectorimagerenderer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp
index 97dad3346d..6d4dc213f2 100644
--- a/engines/sword25/gfx/image/vectorimagerenderer.cpp
+++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp
@@ -270,6 +270,9 @@ ArtVpath *art_vpath_cat(ArtVpath *a, ArtVpath *b) {
len_a = art_vpath_len(a);
len_b = art_vpath_len(b);
dest = art_new(ArtVpath, len_a + len_b + 1);
+ if (!dest)
+ error("[art_vpath_cat] Cannot allocate memory");
+
p = dest;
for (int i = 0; i < len_a; i++)
@@ -299,6 +302,8 @@ ArtVpath *art_vpath_reverse(ArtVpath *a) {
len = art_vpath_len(a);
dest = art_new(ArtVpath, len + 1);
+ if (!dest)
+ error("[art_vpath_reverse] Cannot allocate memory");
for (i = 0; i < len; i++) {
it = a[len - i - 1];
@@ -371,6 +376,8 @@ void drawBez(ArtBpath *bez1, ArtBpath *bez2, byte *buffer, int width, int height
int size = art_vpath_len(vec);
ArtVpath *vect = art_new(ArtVpath, size + 1);
+ if (!vect)
+ error("[drawBez] Cannot allocate memory");
int k;
for (k = 0; k < size; k++) {