Problem with current approach is that if
qemuSecuritySetAllLabel() fails, then the @chown_paths and
@xattr_paths hash tables are not freed and preserve values
already stored there into the next test case.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
ret = 0;
cleanup:
- virHashRemoveAll(chown_paths);
- virHashRemoveAll(xattr_paths);
virMutexUnlock(&m);
return ret;
}
+void freePaths(void)
+{
+ virMutexLock(&m);
+ init_hash();
+
+ virHashFree(chown_paths);
+ virHashFree(xattr_paths);
+ chown_paths = xattr_paths = NULL;
+ virMutexUnlock(&m);
+}
+
+
int
virProcessRunInFork(virProcessForkCallback cb,
void *opaque)
unsetenv(ENVVAR);
virObjectUnref(vm);
virObjectUnref(securityManager);
+ freePaths();
return ret;
}
#define ENVVAR "LIBVIRT_QEMU_SECURITY_TEST"
extern int checkPaths(void);
+
+extern void freePaths(void);