Skip to content

Commit

Permalink
fix(flex) fix NULL pointer dereference
Browse files Browse the repository at this point in the history
fixes #2331
  • Loading branch information
kisvegabor committed Jun 22, 2021
1 parent 713b39e commit 97ba12f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/extra/layouts/flex/lv_flex.c
Original file line number Diff line number Diff line change
@@ -342,8 +342,10 @@ static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id
LV_ASSERT_MALLOC(new_dsc);
if(new_dsc == NULL) return item_id;

lv_memcpy(new_dsc, t->grow_dsc, sizeof(grow_dsc_t) * (t->grow_item_cnt - 1));
lv_mem_buf_release(t->grow_dsc);
if(t->grow_dsc) {
lv_memcpy(new_dsc, t->grow_dsc, sizeof(grow_dsc_t) * (t->grow_item_cnt - 1));
lv_mem_buf_release(t->grow_dsc);
}
new_dsc[t->grow_item_cnt - 1].item = item;
new_dsc[t->grow_item_cnt - 1].min_size = f->row ? lv_obj_get_style_min_width(item, LV_PART_MAIN) : lv_obj_get_style_min_height(item, LV_PART_MAIN);
new_dsc[t->grow_item_cnt - 1].max_size = f->row ? lv_obj_get_style_max_width(item, LV_PART_MAIN) : lv_obj_get_style_max_height(item, LV_PART_MAIN);

0 comments on commit 97ba12f

Please sign in to comment.