diff options
author | Daiki Ueno <dueno@redhat.com> | 2018-05-29 16:35:05 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2018-05-30 15:39:26 +0200 |
commit | 35637892e517d0e8e08dbe214f638317499ea0f5 (patch) | |
tree | 7b81513ccfdcac7ce73edc5a15535d482a025b9e /common | |
parent | ccb0c207964189742e97acfd817fb3c6b99e5865 (diff) |
test: Avoid unnecessary memory allocation
Diffstat (limited to 'common')
-rw-r--r-- | common/test-runtime.c | 7 |
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); |