From d945e56864331387464e225d737b6d9157e0e62d Mon Sep 17 00:00:00 2001
From: deraadt <>
Date: Thu, 8 Jun 2006 00:16:44 +0000
Subject: potential fd leak (we will fix this before we move to cloning)

---
 src/lib/libcrypto/engine/hw_cryptodev.c         | 4 +++-
 src/lib/libssl/src/crypto/engine/hw_cryptodev.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/lib')

diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c
index 924e379ab5..d3b186c132 100644
--- a/src/lib/libcrypto/engine/hw_cryptodev.c
+++ b/src/lib/libcrypto/engine/hw_cryptodev.c
@@ -193,8 +193,10 @@ get_dev_crypto(void)
 
 	if ((fd = open_dev_crypto()) == -1)
 		return (-1);
-	if (ioctl(fd, CRIOGET, &retfd) == -1)
+	if (ioctl(fd, CRIOGET, &retfd) == -1) {
+		close(fd);
 		return (-1);
+	}
 
 	/* close on exec */
 	if (fcntl(retfd, F_SETFD, 1) == -1) {
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
index 924e379ab5..d3b186c132 100644
--- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
+++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
@@ -193,8 +193,10 @@ get_dev_crypto(void)
 
 	if ((fd = open_dev_crypto()) == -1)
 		return (-1);
-	if (ioctl(fd, CRIOGET, &retfd) == -1)
+	if (ioctl(fd, CRIOGET, &retfd) == -1) {
+		close(fd);
 		return (-1);
+	}
 
 	/* close on exec */
 	if (fcntl(retfd, F_SETFD, 1) == -1) {
-- 
cgit v1.2.3-55-g6feb