aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
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;
}