lscpu: fix memory leaks

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2020-11-13 10:20:33 +01:00
parent 8014104bea
commit d4cb6a0335
3 changed files with 4 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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 ||