summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeyur Govande <keyur@php.net>2018-06-04 15:22:50 -0400
committerNikita Popov <nikita.ppv@gmail.com>2018-06-08 23:01:57 +0200
commit695b8192c70c0bf02f1490e4da2b40da1b6f43a6 (patch)
tree113f609c349cf9aad570ebbd4f18539282a600b7
parent0bafb530d639d5fca5d6ed95b5266625b66f2cdf (diff)
downloadphp-git-695b8192c70c0bf02f1490e4da2b40da1b6f43a6.tar.gz
Avoid leaking the urandom fd
When Apache is reloaded, it unloads the extension, but the open file descriptor to /dev/urandom is left hanging around and is leaked. This fixes the bug. Duplicate of https://github.com/jedisct1/libsodium-php/pull/173
-rw-r--r--ext/sodium/libsodium.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c
index 4db1de2436..7b5e791d58 100644
--- a/ext/sodium/libsodium.c
+++ b/ext/sodium/libsodium.c
@@ -637,6 +637,7 @@ PHP_MINIT_FUNCTION(sodium)
PHP_MSHUTDOWN_FUNCTION(sodium)
{
+ randombytes_close();
return SUCCESS;
}