summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/onetimebluh.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/onetimebluh.c b/src/onetimebluh.c
index dce4a6b..4cbd99a 100644
--- a/src/onetimebluh.c
+++ b/src/onetimebluh.c
@@ -357,8 +357,9 @@ void keyrand (Opts* opzioni) {
unsigned char* key = malloc (opzioni->nbytes);
RAND_bytes (key, opzioni->nbytes);
- FILE* file;
if (opzioni->output) {
+ FILE* file;
+
file = fopen (opzioni->output, "w");
fwrite (key, sizeof(char), opzioni->nbytes, file);
fclose (file);
@@ -373,6 +374,7 @@ void keyrand (Opts* opzioni) {
}
fprintf (stdout, "%s", key);
+ free (key);
if (!opzioni->quiet) {
printf ("\n");