aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/edje
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-24 13:26:28 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-24 13:26:28 +0900
commit8e311db414950e399099acc1c0af620ee2f37b52 (patch)
tree7e321ac3e472b0ddd4344c993a7b0bb5dd892a73 /src/bin/edje
parentedje convert - make realloc fatal and complain about it (diff)
downloadefl-8e311db414950e399099acc1c0af620ee2f37b52.tar.gz
edje_cc - make svg loader (still beta) handle out of memory nicely
print ERR and abort.
Diffstat (limited to 'src/bin/edje')
-rw-r--r--src/bin/edje/edje_svg_loader.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c
index beafb48a59..65e17f1094 100644
--- a/src/bin/edje/edje_svg_loader.c
+++ b/src/bin/edje/edje_svg_loader.c
@@ -1113,7 +1113,15 @@ _attr_parse_polygon_points(const char *str, double **points, int *point_count)
tmp[tmp_count++] = num;
if (tmp_count == 50)
{
- point_array = realloc(point_array, (count + tmp_count) * sizeof(double));
+ double *tmp;
+
+ tmp = realloc(point_array, (count + tmp_count) * sizeof(double));
+ if (!tmp)
+ {
+ ERR("allocation for point array failed. out of memory");
+ abort();
+ }
+ point_array = tmp;
memcpy(&point_array[count], tmp, tmp_count * sizeof(double));
count += tmp_count;
tmp_count = 0;
@@ -1122,7 +1130,15 @@ _attr_parse_polygon_points(const char *str, double **points, int *point_count)
if (tmp_count > 0)
{
- point_array = realloc(point_array, (count + tmp_count) * sizeof(double));
+ double *tmp;
+
+ tmp = realloc(point_array, (count + tmp_count) * sizeof(double));
+ if (!tmp)
+ {
+ ERR("allocation for point array failed. out of memory");
+ abort();
+ }
+ point_array = tmp;
memcpy(&point_array[count], tmp, tmp_count * sizeof(double));
count += tmp_count;
}