From d63c97614f2b15640c694d5e718264901f003aef Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Tue, 24 May 2022 18:21:33 +0200 Subject: [PATCH] moved fileBuffer deallocation to beggining of encrypter it for some reason threw segfault --- src/lib/encrypter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/encrypter.c b/src/lib/encrypter.c index b6d57ad..21a9e22 100644 --- a/src/lib/encrypter.c +++ b/src/lib/encrypter.c @@ -25,6 +25,7 @@ outputFlags encryptText(char *text, char *keyNew, inputFlags flags) fileBuffer = fopen("/dev/urandom", "r"); fread(&numberBuffer, 4, 1, fileBuffer); srand(numberBuffer); + fclose(fileBuffer); if (keyNew != NULL) { @@ -112,7 +113,6 @@ outputFlags encryptText(char *text, char *keyNew, inputFlags flags) }; //DEALLOCATION - fclose(fileBuffer); free(textKeyChain); free(textBuffer);