summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-05-29 16:35:05 +0200
committerDaiki Ueno <ueno@gnu.org>2018-05-30 15:39:26 +0200
commit35637892e517d0e8e08dbe214f638317499ea0f5 (patch)
tree7b81513ccfdcac7ce73edc5a15535d482a025b9e
parentccb0c207964189742e97acfd817fb3c6b99e5865 (diff)
test: Avoid unnecessary memory allocation
-rw-r--r--common/test-runtime.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/common/test-runtime.c b/common/test-runtime.c
index 1594a9c..51071b8 100644
--- a/common/test-runtime.c
+++ b/common/test-runtime.c
@@ -86,6 +86,7 @@ test_bases (void)
NULL
};
char *user, *path;
+ CK_RV rv;
if (asprintf (&user, "%s/user", test.directory) < 0)
assert_not_reached ();
@@ -96,15 +97,13 @@ test_bases (void)
free (user);
if (mkdir (path, 0700) < 0)
assert_not_reached ();
- free (path);
bases[0] = test.directory;
_p11_runtime_bases = bases;
unsetenv ("XDG_RUNTIME_DIR");
- p11_get_runtime_directory (&directory);
- if (asprintf (&path, "%s/user/%d", test.directory, getuid ()) < 0)
- assert_not_reached ();
+ rv = p11_get_runtime_directory (&directory);
+ assert_num_eq (CKR_OK, rv);
assert_str_eq (path, directory);
free (path);
free (directory);