From: Karel Zak Date: Fri, 13 Nov 2020 09:20:33 +0000 (+0100) Subject: lscpu: fix memory leaks X-Git-Tag: v2.37-rc1~292 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4cb6a0335d328b7653f2456b90e8101eb00e69b;p=thirdparty%2Futil-linux.git lscpu: fix memory leaks Signed-off-by: Karel Zak --- diff --git a/sys-utils/lscpu-cpu.c b/sys-utils/lscpu-cpu.c index 70b40c5413..6250cf70cc 100644 --- a/sys-utils/lscpu-cpu.c +++ b/sys-utils/lscpu-cpu.c @@ -36,6 +36,7 @@ void lscpu_unref_cpu(struct lscpu_cpu *cpu) free(cpu->dynamic_mhz); free(cpu->static_mhz); free(cpu->mhz); + free(cpu->bogomips); free(cpu); } } diff --git a/sys-utils/lscpu-cputype.c b/sys-utils/lscpu-cputype.c index eacbb87b58..e478d2acc6 100644 --- a/sys-utils/lscpu-cputype.c +++ b/sys-utils/lscpu-cputype.c @@ -74,10 +74,12 @@ void lscpu_unref_cputype(struct lscpu_cputype *ct) DBG(TYPE, ul_debugobj(ct, " freeing %s/%s", ct->vendor, ct->model)); lscpu_cputype_free_topology(ct); free(ct->vendor); + free(ct->bios_vendor); free(ct->machinetype); /* s390 */ free(ct->family); free(ct->model); free(ct->modelname); + free(ct->bios_modelname); free(ct->revision); /* alternative for model (ppc) */ free(ct->stepping); free(ct->bogomips); diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 93b0860d3f..6e501b0442 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -917,6 +917,7 @@ static void print_summary(struct lscpu_cxt *cxt) scols_symbols_set_vertical(sy, " "); scols_symbols_set_right(sy, " "); scols_table_set_symbols(tb, sy); + scols_unref_symbols(sy); } if (scols_table_new_column(tb, "field", 0, is_term ? SCOLS_FL_TREE : 0) == NULL ||