[libvirt] [PATCH] qemuTestDriverInit: fill driver with zeroes

Jiri Denemark jdenemar at redhat.com
Mon Jan 18 09:22:41 UTC 2016


On Mon, Jan 18, 2016 at 09:23:58 +0100, Michal Privoznik wrote:
> In the commit aea47e48c473a we have fixed a single pointer within
> driver structure. Since all callers pass statically allocated
> driver on stack other pointers within driver may contain random
> values too. Before touching it lets overwrite it with zeroes and
> thus fix all dangling pointers.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  tests/testutilsqemu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
> index f2eacdd..6c52b96 100644
> --- a/tests/testutilsqemu.c
> +++ b/tests/testutilsqemu.c
> @@ -558,7 +558,7 @@ int qemuTestDriverInit(virQEMUDriver *driver)
>      if (virMutexInit(&driver->lock) < 0)
>          return -1;
>  
> -    driver->securityManager = NULL;
> +    memset(driver, 0, sizeof(*driver));

I'm afraid you just killed the just initialized mutex...

Jirka




More information about the libvir-list mailing list