fix memory leak in obj create functions if ext alloc fails

This commit is contained in:
Gabor Kiss-Vamosi
2019-12-03 18:16:14 +01:00
parent 664a538e85
commit c7374948a1
36 changed files with 154 additions and 38 deletions

View File

@@ -70,7 +70,10 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy)
/*Allocate the slider type specific extended data*/
lv_slider_ext_t * ext = lv_obj_allocate_ext_attr(new_slider, sizeof(lv_slider_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) return NULL;
if(ext == NULL) {
lv_obj_del(new_slider);
return NULL;
}
/*Initialize the allocated 'ext' */
ext->style_knob = &lv_style_pretty;