summaryrefslogtreecommitdiff
path: root/src/static_libs
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-02-18 15:17:41 +0900
committerHermet Park <hermetpark@gmail.com>2019-02-21 10:36:49 +0900
commit9a5dacdb3684c7b0e4bc939ef1920f69e82aeaa2 (patch)
tree10c1e9a911236fd606f569c13e142054d30086f4 /src/static_libs
parent0a47a0ef3274b37508f0ddc31d0153d4a244d1f2 (diff)
evas vg: check for OOM when calloc()
Diffstat (limited to 'src/static_libs')
-rw-r--r--src/static_libs/vg_common/vg_common_svg.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c
index 9c69b14..6b18a0e 100644
--- a/src/static_libs/vg_common/vg_common_svg.c
+++ b/src/static_libs/vg_common/vg_common_svg.c
@@ -899,6 +899,7 @@ _create_gradient_node(Efl_VG *vg)
899 for (i = 0; i < count; i++) 899 for (i = 0; i < count; i++)
900 { 900 {
901 new_stop = calloc(1, sizeof(Efl_Gfx_Gradient_Stop)); 901 new_stop = calloc(1, sizeof(Efl_Gfx_Gradient_Stop));
902 if (!new_stop) goto oom_error;
902 memcpy(new_stop, stops, sizeof(Efl_Gfx_Gradient_Stop)); 903 memcpy(new_stop, stops, sizeof(Efl_Gfx_Gradient_Stop));
903 grad->stops = eina_list_append(grad->stops, new_stop); 904 grad->stops = eina_list_append(grad->stops, new_stop);
904 stops++; 905 stops++;
@@ -907,6 +908,7 @@ _create_gradient_node(Efl_VG *vg)
907 { 908 {
908 grad->type = SVG_LINEAR_GRADIENT; 909 grad->type = SVG_LINEAR_GRADIENT;
909 grad->linear = calloc(1, sizeof(Svg_Linear_Gradient)); 910 grad->linear = calloc(1, sizeof(Svg_Linear_Gradient));
911 if (!grad->linear) goto oom_error;
910 evas_vg_gradient_linear_start_get(vg, &grad->linear->x1, &grad->linear->y1); 912 evas_vg_gradient_linear_start_get(vg, &grad->linear->x1, &grad->linear->y1);
911 evas_vg_gradient_linear_end_get(vg, &grad->linear->x2, &grad->linear->y2); 913 evas_vg_gradient_linear_end_get(vg, &grad->linear->x2, &grad->linear->y2);
912 } 914 }
@@ -914,12 +916,18 @@ _create_gradient_node(Efl_VG *vg)
914 { 916 {
915 grad->type = SVG_RADIAL_GRADIENT; 917 grad->type = SVG_RADIAL_GRADIENT;
916 grad->radial = calloc(1, sizeof(Svg_Radial_Gradient)); 918 grad->radial = calloc(1, sizeof(Svg_Radial_Gradient));
919 if (!grad->radial) goto oom_error;
917 evas_vg_gradient_radial_center_get(vg, &grad->radial->cx, &grad->radial->cy); 920 evas_vg_gradient_radial_center_get(vg, &grad->radial->cx, &grad->radial->cy);
918 evas_vg_gradient_radial_focal_get(vg, &grad->radial->fx, &grad->radial->fy); 921 evas_vg_gradient_radial_focal_get(vg, &grad->radial->fx, &grad->radial->fy);
919 grad->radial->r = evas_vg_gradient_radial_radius_get(vg); 922 grad->radial->r = evas_vg_gradient_radial_radius_get(vg);
920 } 923 }
921 924
922 return grad; 925 return grad;
926
927oom_error:
928 ERR("OOM: Failed calloc()");
929 return grad;
930
923} 931}
924 932
925static void 933static void