From 35637892e517d0e8e08dbe214f638317499ea0f5 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 29 May 2018 16:35:05 +0200 Subject: test: Avoid unnecessary memory allocation --- common/test-runtime.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'common') 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); -- cgit v1.1