netstar pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=29ca5ff055169093db83a98fc006e581fecbe4ae
commit 29ca5ff055169093db83a98fc006e581fecbe4ae Author: Alastair Poole <nets...@gmail.com> Date: Sun Mar 7 19:22:17 2021 +0000 procstats: Fix leak --- src/modules/procstats/e_mod_main.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/modules/procstats/e_mod_main.c b/src/modules/procstats/e_mod_main.c index f5221af52..99009eec6 100644 --- a/src/modules/procstats/e_mod_main.c +++ b/src/modules/procstats/e_mod_main.c @@ -178,10 +178,11 @@ _proc_stats_item_children_update(Eina_List *children, Proc_Stats *item) } } -static const char * +static char * _size_format(unsigned long long bytes) { const char *units = "BKMGTPEZY"; + char buf[1024]; unsigned long powi = 1; unsigned long long value; unsigned int precision = 2, powj = 1; @@ -201,13 +202,17 @@ _size_format(unsigned long long bytes) if ((value / powi) < powj) break; --precision; } - return eina_slstr_printf("%1.*f%c", precision, (double) value / powi, *units); + snprintf(buf, sizeof(buf), "%1.*f%c", precision, (double) value / powi, *units); + + return strdup(buf); } static void _proc_stats_item_display(Proc_Stats *item) { Evas_Object *pb; + Eina_Strbuf *buf; + char *s; double val = 0.0; if (item->cpu_time_prev > item->cpu_time) @@ -219,14 +224,26 @@ _proc_stats_item_display(Proc_Stats *item) val = (item->cpu_time - item->cpu_time_prev) / _TIMER_FREQ; elm_progressbar_value_set(pb, val / 100.0); - elm_object_part_text_set(pb, "elm.text.status", eina_slstr_printf("%1.0f %%", val)); + + buf = eina_strbuf_new(); + + eina_strbuf_append_printf(buf, "%1.0f %%", val); + elm_object_part_text_set(pb, "elm.text.status", eina_strbuf_string_get(buf)); + eina_strbuf_reset(buf); pb = evas_object_data_get(item->obj_swallow, "pb_mem"); val = item->mem_size / (_mem_total / 100.0); elm_progressbar_value_set(pb, val / 100.0); - elm_object_part_text_set(pb, "elm.text.status", - eina_slstr_printf("%s/%s", _size_format(item->mem_size), - _size_format(_mem_total))); + + s = _size_format(item->mem_size); + eina_strbuf_append_printf(buf, "%s/", s); + free(s); + s = _size_format(_mem_total); + eina_strbuf_append(buf, s); + free(s); + + elm_object_part_text_set(pb, "elm.text.status", eina_strbuf_string_get(buf)); + eina_strbuf_free(buf); } static void --