fix memory leak in obj create functions if ext alloc fails
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user