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

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

 



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.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]