]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuTestDriverInit: fill driver with zeroes
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 18 Jan 2016 08:11:19 +0000 (09:11 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 18 Jan 2016 12:22:14 +0000 (13:22 +0100)
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@redhat.com>
tests/testutilsqemu.c

index f2eacdded53d2404bfda4eacfedc626bd28d6be9..ae69a18f529aa4d4f76948761bc23c8f2481b9b3 100644 (file)
@@ -555,11 +555,11 @@ int qemuTestCapsCacheInsert(virQEMUCapsCachePtr cache, const char *binary,
 
 int qemuTestDriverInit(virQEMUDriver *driver)
 {
+    memset(driver, 0, sizeof(*driver));
+
     if (virMutexInit(&driver->lock) < 0)
         return -1;
 
-    driver->securityManager = NULL;
-
     driver->config = virQEMUDriverConfigNew(false);
     if (!driver->config)
         goto error;