]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Don't free the constructed string in virDomainGetBlkioParametersAssignFromDef
authorPeter Krempa <pkrempa@redhat.com>
Thu, 30 Jun 2016 12:33:24 +0000 (14:33 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 30 Jun 2016 13:07:55 +0000 (15:07 +0200)
virTypedParameterAssign steals the string rather than copying it into
the typed parameter and thus freeing it leads to a crash when attempting
to serialize the results.

This was introduced in commit 9f50f6e2 and later made an universal
helper in 32e6339c.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1351473

src/conf/domain_conf.c

index 7d40f26573d1cfa17cd1f21a966090e6e3da930d..78e394d169f6199a29160853a1931a8d695df8ac 100644 (file)
@@ -24936,7 +24936,7 @@ virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
         if (virTypedParameterAssign(&(params[(*nparams)++]), name,             \
                                     VIR_TYPED_PARAM_STRING, data) < 0)         \
             goto error;                                                        \
-        VIR_FREE(data);                                                        \
+        data = NULL;                                                           \
     }
 
     /* blkiotune.device_weight */