aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-03-03 20:21:20 +0000
committerJoursoir <chat@joursoir.net>2021-03-03 20:21:20 +0000
commit1c5f7fd29fce3008218d781ab148a6974e898cac (patch)
tree54e1da521c476ca510e5db6cb830c0e58049b665 /src/main.c
parent8a48afccb97462b0dc261e8c99c0825295ebc019 (diff)
downloadlock-password-1c5f7fd29fce3008218d781ab148a6974e898cac.tar.gz
lock-password-1c5f7fd29fce3008218d781ab148a6974e898cac.tar.bz2
lock-password-1c5f7fd29fce3008218d781ab148a6974e898cac.zip
some chore and delete useless thing
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 4b19e82..1b33323 100644
--- a/src/main.c
+++ b/src/main.c
@@ -290,18 +290,21 @@ int cmd_generate(int argc, char *argv[])
errprint(1, "You can't generate password for directory\n");
// generate password
- char g_pass[pass_length];
- gen_password(g_pass, pass_length);
+ char *g_pass;
+ g_pass = gen_password(pass_length);
result = insert_pass(path, g_pass);
- if(result)
+ if(result) {
+ free(g_pass);
errprint(1, "Can't add password to LockPassword");
+ }
if(flag_copy)
copy_outside(g_pass);
else
printf("Generated password: %s\n", g_pass);
printf("Password added successfully for %s\n", path);
+ free(g_pass);
return 0;
}