Re: [PATCH 3/4] virpcivpdtest: Fix potential double-free()

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

 



On Mon, Jan 31, 2022 at 03:53:41PM +0100, Michal Privoznik wrote:
> Inside the testPCIVPDResourceCustomCompareIndex() function we
> have two variables @a and @b, both marked as g_autoptr(). Then,
> towards the end of the function b->value is freed and set to
> a->value. This is to make sure
> virPCIVPDResourceCustomCompareIndex() works correctly even if
> ->value member is the same for both arguments.
> 
> Nevertheless, if the function returns anything else than 0 then
> the control executes subsequent return statement and since
> b->value points to the very same string as a->value a double free
> will occur. Avoid this by setting b->value to NULL explicitly,
> just like we are already doing for the successful path.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>




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

  Powered by Linux