mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(vector): fix memory leak for reset stroke dash array. (#5223)
Signed-off-by: zhangjipeng <zhangjipeng@xiaomi.com> Co-authored-by: zhangjipeng <zhangjipeng@xiaomi.com>
This commit is contained in:
parent
d7aa3baf9a
commit
a9960c6216
@ -588,7 +588,13 @@ void lv_vector_dsc_set_stroke_dash(lv_vector_dsc_t * dsc, float * dash_pattern,
|
||||
{
|
||||
lv_array_t * dash_array = &(dsc->current_dsc.stroke_dsc.dash_pattern);
|
||||
if(dash_pattern) {
|
||||
LV_ARRAY_INIT_CAPACITY(dash_array, dash_count, float);
|
||||
lv_array_clear(dash_array);
|
||||
if(lv_array_capacity(dash_array) == 0) {
|
||||
LV_ARRAY_INIT_CAPACITY(dash_array, dash_count, float);
|
||||
}
|
||||
else {
|
||||
lv_array_resize(dash_array, dash_count);
|
||||
}
|
||||
for(uint16_t i = 0; i < dash_count; i++) {
|
||||
LV_ARRAY_APPEND_VALUE(dash_array, dash_pattern[i]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user