Skip to content

Commit 6e7ad24

Browse files
authored
fix(draw_sw_box_shadow): add ASSERT_MALLOC check (lvgl#7344)
1 parent 86d4385 commit 6e7ad24

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/draw/sw/lv_draw_sw_box_shadow.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_
104104
if(cache->cache_size == corner_size && cache->cache_r == r_sh) {
105105
/*Use the cache if available*/
106106
sh_buf = lv_malloc(corner_size * corner_size);
107+
LV_ASSERT_MALLOC(sh_buf);
107108
lv_memcpy(sh_buf, cache->cache, corner_size * corner_size);
108109
}
109110
else {
110111
/*A larger buffer is required for calculation*/
111112
sh_buf = lv_malloc(corner_size * corner_size * sizeof(uint16_t));
113+
LV_ASSERT_MALLOC(sh_buf);
112114
shadow_draw_corner_buf(&core_area, (uint16_t *)sh_buf, dsc->width, r_sh);
113115

114116
/*Cache the corner if it fits into the cache size*/
@@ -120,6 +122,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_
120122
}
121123
#else
122124
sh_buf = lv_malloc(corner_size * corner_size * sizeof(uint16_t));
125+
LV_ASSERT_MALLOC(sh_buf);
123126
shadow_draw_corner_buf(&core_area, (uint16_t *)sh_buf, dsc->width, r_sh);
124127
#endif /*LV_DRAW_SW_SHADOW_CACHE_SIZE*/
125128

0 commit comments

Comments
 (0)