>>  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

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to