1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(sysmon): fix heap memory overflow (#7576)

This commit is contained in:
Chishin 2025-01-10 10:27:59 +08:00 committed by GitHub
parent 51a3d93852
commit 4e52b15508
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,17 +105,19 @@ void lv_sysmon_show_performance(lv_display_t * disp)
return;
}
disp->perf_label = lv_sysmon_create(disp);
if(disp->perf_label == NULL) {
LV_LOG_WARN("Couldn't create sysmon");
return;
}
disp->perf_label = lv_sysmon_create(disp);
if(disp->perf_label == NULL) {
LV_LOG_WARN("Couldn't create sysmon");
return;
}
lv_subject_init_pointer(&disp->perf_sysmon_backend.subject, &disp->perf_sysmon_info);
lv_obj_align(disp->perf_label, LV_USE_PERF_MONITOR_POS, 0, 0);
lv_subject_add_observer_obj(&disp->perf_sysmon_backend.subject, perf_observer_cb, disp->perf_label, NULL);
disp->perf_sysmon_backend.timer = lv_timer_create(perf_update_timer_cb, LV_SYSMON_REFR_PERIOD_DEF, disp);
lv_display_add_event_cb(disp, perf_monitor_disp_event_cb, LV_EVENT_ALL, NULL);
lv_subject_init_pointer(&disp->perf_sysmon_backend.subject, &disp->perf_sysmon_info);
lv_obj_align(disp->perf_label, LV_USE_PERF_MONITOR_POS, 0, 0);
lv_subject_add_observer_obj(&disp->perf_sysmon_backend.subject, perf_observer_cb, disp->perf_label, NULL);
disp->perf_sysmon_backend.timer = lv_timer_create(perf_update_timer_cb, LV_SYSMON_REFR_PERIOD_DEF, disp);
lv_display_add_event_cb(disp, perf_monitor_disp_event_cb, LV_EVENT_ALL, NULL);
}
#if LV_USE_PERF_MONITOR_LOG_MODE
lv_obj_add_flag(disp->perf_label, LV_OBJ_FLAG_HIDDEN);
@ -147,14 +149,16 @@ void lv_sysmon_show_memory(lv_display_t * disp)
return;
}
disp->mem_label = lv_sysmon_create(disp);
if(disp->mem_label == NULL) {
LV_LOG_WARN("Couldn't create sysmon");
return;
}
disp->mem_label = lv_sysmon_create(disp);
if(disp->mem_label == NULL) {
LV_LOG_WARN("Couldn't create sysmon");
return;
}
lv_obj_align(disp->mem_label, LV_USE_MEM_MONITOR_POS, 0, 0);
lv_subject_add_observer_obj(&sysmon_mem.subject, mem_observer_cb, disp->mem_label, NULL);
lv_obj_align(disp->mem_label, LV_USE_MEM_MONITOR_POS, 0, 0);
lv_subject_add_observer_obj(&sysmon_mem.subject, mem_observer_cb, disp->mem_label, NULL);
}
lv_obj_remove_flag(disp->mem_label, LV_OBJ_FLAG_HIDDEN);
}