diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-11-18 10:53:13 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-11-18 10:53:13 +0100 |
commit | 4e7eda5c5df043aa79effa89925fcd4a5abf9be2 (patch) | |
tree | 4b1a9551987f90bc47ef411bee438606a63a92d0 /src | |
parent | 54edf4c9c502d654eb1df194e26810a5999debc1 (diff) | |
download | ODR-SourceCompanion-4e7eda5c5df043aa79effa89925fcd4a5abf9be2.tar.gz ODR-SourceCompanion-4e7eda5c5df043aa79effa89925fcd4a5abf9be2.tar.bz2 ODR-SourceCompanion-4e7eda5c5df043aa79effa89925fcd4a5abf9be2.zip |
Fix leak of fd in readkey
Diffstat (limited to 'src')
-rw-r--r-- | src/encryption.c | 4 |
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 */ |