[libvirt] [PATCH v2 12/20] cpu: Align ppc64 CPU data with x86

John Ferlan jferlan at redhat.com
Fri Aug 7 20:45:07 UTC 2015


>>  static virCPUDataPtr
>>  ppc64DriverNodeData(virArch arch)
>>  {
>> -    virCPUDataPtr cpuData;
>> +    virCPUDataPtr nodeData;
>> +    virCPUppc64Data *data;
>>  
>> -    if (VIR_ALLOC(cpuData) < 0)
>> -        return NULL;
>> +    if (VIR_ALLOC(nodeData) < 0)
>> +        goto error;
>>  
>> -    cpuData->arch = arch;
>> +    data = nodeData->data.ppc64;
>> +
>> +    if (VIR_ALLOC(data) < 0)
>> +        goto error;
> 
> Coverity complains that 'data' isn't free'd (or stored to be free'd)
> anywhere from here...

if you change the code as follows, the Coverity issue goes away (as does
the follow-up patch (13) where data->pvr is allocated.  That one is fine...

    if (VIR_ALLOC(nodeData->data.ppc64) < 0)
        goto error;
    data = nodeData->data.ppc64;

The issue is 'data' is a local, the VIR_ALLOC will overwrite the initial
setting.

John




More information about the libvir-list mailing list