aboutsummaryrefslogtreecommitdiffstats
path: root/src/ck.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-04-17 12:30:44 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-04-17 17:39:29 +0300
commit562bad603ce0fe2a6556f0f1aae4f08c9c300987 (patch)
tree8646982cdcd625dcf7f04262b66d9e78bf53afe4 /src/ck.c
parent94bc38df829c4816e629c7dcaed31b1e7c75bc4b (diff)
downloadck-562bad603ce0fe2a6556f0f1aae4f08c9c300987.tar.gz
ck-562bad603ce0fe2a6556f0f1aae4f08c9c300987.tar.bz2
ck-562bad603ce0fe2a6556f0f1aae4f08c9c300987.zip
fix memory leaks, add logo
Diffstat (limited to 'src/ck.c')
-rw-r--r--src/ck.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/ck.c b/src/ck.c
index 61797b4..98190b1 100644
--- a/src/ck.c
+++ b/src/ck.c
@@ -26,30 +26,24 @@ int main(int argc, char *argv[]) {
if (opt.action != CKA_INIT) {
if (!db_exists(&opt)) {
printf("ck is not initialized in %s.\nRun ck init first.\n", opt.confDir);
+ free_user_opt(&opt);
return 1;
}
if (!config_file_parse(&conf, &opt)) {
+ free_user_opt(&opt);
return 1;
}
}
- int ok;
- switch(opt.action) {
-#define X(ACTION) \
- case CKA_##ACTION: \
- ok = run_##ACTION(&opt, &conf); \
- break;
- CK_ACTIONS
-#undef X
- }
+ /* Run action and print results */
switch(opt.action) {
-#define X(ACTION) \
- case CKA_##ACTION: \
- print_##ACTION##_result(ok); \
+#define X(ACTION) \
+ case CKA_##ACTION: \
+ print_##ACTION##_result(run_##ACTION(&opt, &conf)); \
break;
CK_ACTIONS
-#undef X
+#undef X
}
free_user_opt(&opt);
return 0;