]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu_x86: Fix memory leak in virCPUx86Translate
authorJiri Denemark <jdenemar@redhat.com>
Thu, 9 Feb 2017 08:25:51 +0000 (09:25 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 9 Feb 2017 10:48:10 +0000 (11:48 +0100)
virCPUDefStealModel is called with keepVendor == true which means the
cpu structure will keep its original vendor/vendor_id values. Thus it
makes no sense to copy them to the translated definition as they won't
be used there anyway. Except that the translated->vendor pointer might
get lost in x86Decode.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/cpu/cpu_x86.c

index 23a519ec00827de7cc9857dbc57401895b7a6ee4..9e22f896e9b9bf4b3c4152dd6565fa2fdecfe935 100644 (file)
@@ -2709,10 +2709,6 @@ virCPUx86Translate(virCPUDefPtr cpu,
     if (!(translated = virCPUDefCopyWithoutModel(cpu)))
         goto cleanup;
 
-    if (VIR_STRDUP(translated->vendor, cpu->vendor) < 0 ||
-        VIR_STRDUP(translated->vendor_id, cpu->vendor_id) < 0)
-        goto cleanup;
-
     if (x86Decode(translated, &model->data, models, nmodels, NULL, 0) < 0)
         goto cleanup;