[PATCH 4/9] util: Fix memory leak in virPCIProbeStubDriver

Peter Krempa pkrempa at redhat.com
Tue Jun 16 12:19:46 UTC 2020


On Tue, Jun 16, 2020 at 08:07:05 -0400, John Ferlan wrote:
> Since 9ea90206, @drvpath could be overwritten if we jumped to recheck
> 
> Found by Coverity.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/util/virpci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/util/virpci.c b/src/util/virpci.c
> index 6c7e6bbcab..16936c4be9 100644
> --- a/src/util/virpci.c
> +++ b/src/util/virpci.c
> @@ -1018,6 +1018,7 @@ virPCIProbeStubDriver(virPCIStubDriver driver)
>              goto cleanup;
>          }
>  
> +        g_free(drvpath);

The variable is reused so please use VIR_FREE as g_free doesn't clear
the pointer.

>          goto recheck;
>      }
>  
> -- 
> 2.25.4
> 




More information about the libvir-list mailing list