1
0
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:
Zhang Ji Peng 2024-01-08 20:43:25 +08:00 committed by GitHub
parent d7aa3baf9a
commit a9960c6216
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]);
}