How to recycle lv_obj_t properly?

I have something like this:

lv_obj_t* parent_view = lv_obj_create(NULL, NULL);

lv_font_t* font_label = (lv_font_t*)malloc(sizeof(lv_font_t));
lv_font_fmt_freetype_dsc_t * font_dsc = (lv_font_fmt_freetype_dsc_t*)lv_mem_alloc(sizeof(lv_font_fmt_freetype_dsc_t));
lv_style_t* style_label = (lv_style_t*)malloc(sizeof(lv_style_t));
lv_obj_t* label_view = lv_label_create(parent_view, NULL);
//set style for label_view

lv_img_dsc_t* image_dsc = (lv_img_dsc_t*)malloc(sizeof(lv_img_dsc_t));
void* image = (void*)Some_PNG_Decoder();
lv_obj_t * image_view = lv_img_create(parent_view, NULL);
//set image for image_view 

lv_style_t* style_parent = = (lv_style_t*)malloc(sizeof(lv_style_t));
//set parent style



As you can see, There are a parent view and two child views here. After displaying them, I want to recycle them. So what I should do to make sure they are properly recycled and no memory leak occurs.
Thanks !

I suggest that you add an event callback to each view and free the resources in LV_EVENT_DELETE.

Thanks, embeddedt. So I have to free all these pointers except lv_obj_t* in LV_EVENT_DELETE, is that correct?

I had read the source code and had a rough idea about my problem.

As embeddedt suggested, I should free all the pointers except lv_font_t* in LV_EVENT_DELETE.

Yes; you should free everything except the object itself.