[libvirt] [PATCH v3 01/11] Add QMP probing for TPM

Eric Blake eblake at redhat.com
Mon Apr 1 19:57:36 UTC 2013


On 04/01/2013 01:52 PM, Stefan Berger wrote:
> On 04/01/2013 03:45 PM, Corey Bryant wrote:
>>> +    if (ret < 0)
>>> +        goto cleanup;
>>> +
>>> +    ret = -1;
>>> +
>>> +    if (!(data = virJSONValueObjectGet(reply, "return"))) {
>>> +        virReportError(VIR_ERR_INTERNAL_ERROR,
>>> +                       _("%s reply was missing return data"),
>>> +                       qmpCmd);
>>> +        goto cleanup;
>>> +    }
>>> +

>>> +cleanup:
>>> +    if (ret < 0)
>>> +        virStringFreeList(list);
>>> +    virJSONValueFree(cmd);
>>> +    virJSONValueFree(reply);
>> +
>>
>> Does data need to be freed?
>>
> 
> It doesn't seem to be the case for the 'return' object. No other code
> frees it, either.

data is a pointer to contents already within reply; freeing reply is
recursive, and explicitly freeing data in addition to reply would be a
double-free bug.  This aspect of the code is correct as written.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130401/b0627684/attachment-0001.sig>


More information about the libvir-list mailing list