提交 8ffb5f27 编写于 作者: M Michal Privoznik

qemusecuritymock: Introduce and use freePaths()

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 80cf6ec6
......@@ -411,13 +411,23 @@ int checkPaths(void)
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)
......
......@@ -125,6 +125,7 @@ testDomain(const void *opaque)
unsetenv(ENVVAR);
virObjectUnref(vm);
virObjectUnref(securityManager);
freePaths();
return ret;
}
......
......@@ -21,3 +21,5 @@
#define ENVVAR "LIBVIRT_QEMU_SECURITY_TEST"
extern int checkPaths(void);
extern void freePaths(void);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册