]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: cleanup lscpu_unref_cputype()
authorKarel Zak <kzak@redhat.com>
Thu, 7 May 2020 13:08:13 +0000 (15:08 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 13 Nov 2020 08:19:02 +0000 (09:19 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-cputype.c

index d88b382523cbf3cae664d7b3454f575f62c8ee15..b221c8d1c45a03df9b497ca9d72bbad6ca20c4cd 100644 (file)
@@ -93,6 +93,19 @@ void lscpu_unref_cputype(struct lscpu_cputype *ct)
 
        if (--ct->refcount <= 0) {
                DBG(TYPE, ul_debugobj(ct, "  freeing"));
+               free(ct->vendor);
+               free(ct->machinetype);  /* s390 */
+               free(ct->family);
+               free(ct->model);
+               free(ct->modelname);
+               free(ct->revision);     /* alternative for model (ppc) */
+               free(ct->virtflag);     /* virtualization flag (vmx, svm) */
+               free(ct->hypervisor);   /* hypervisor software */
+               free(ct->stepping);
+               free(ct->bogomips);
+               free(ct->flags);
+               free(ct->mtid);         /* maximum thread id (s390) */
+               free(ct->addrsz);       /* address sizes */
                free(ct);
        }
 }
@@ -139,8 +152,6 @@ struct lscpu_cputype *lscpu_add_cputype(struct lscpu_cxt *cxt, struct lscpu_cput
 
 static void lscpu_merge_cputype(struct lscpu_cputype *a, struct lscpu_cputype *b)
 {
-       if (!a->arch && b->arch)
-               a->arch = xstrdup(b->arch);
        if (!a->vendor && b->vendor)
                a->vendor = xstrdup(b->vendor);
        if (!a->machinetype && b->machinetype)