diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2018-04-17 12:30:44 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2018-04-17 17:39:29 +0300 |
commit | 562bad603ce0fe2a6556f0f1aae4f08c9c300987 (patch) | |
tree | 8646982cdcd625dcf7f04262b66d9e78bf53afe4 /src/ck.c | |
parent | 94bc38df829c4816e629c7dcaed31b1e7c75bc4b (diff) | |
download | ck-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.c | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -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; |