[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] cpu_x86.c: avoid NULL-deref for invalid arguments



Jiri Denemark wrote:
...
>> @@ -954,6 +954,9 @@ x86Decode(virCPUDefPtr cpu,
>>      if (data == NULL || (map = x86LoadMap()) == NULL)
>>          return -1;
>>
>> +    if (models == NULL && nmodels != 0)
>> +        return -1;
>> +
>
> Hmm, this check introduces a possible memory leak, as it exists the function
> without freeing map. We could just move the check at the beginning of the
> function but since this is a private architecture specific implementation for
> cpuDecode, I'd rather move the check one level up to the arch independent
> entry point. A patch for that is attached.

> Subject: [PATCH] Move models/nmodels mismatch checking one level up

Hi Jirka,

Good catch.
That's a fine change: plugs a leak and improves the higher-level interface.
Thank you.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]