aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/encryption.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/encryption.c b/src/encryption.c
index f39fd28..c980e4c 100644
--- a/src/encryption.c
+++ b/src/encryption.c
@@ -29,8 +29,10 @@ int readkey(const char* keyfile, char* key)
if (fd < 0)
return fd;
int ret = read(fd, key, CURVE_KEYLEN);
- if (ret < 0)
+ if (ret < 0) {
+ close(fd);
return ret;
+ }
close(fd);
/* It needs to be zero-terminated */