From d161f5a9b26c751682dca4c4cc08fab6cf88ee1d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lutz=20J=C3=A4nicke?= Date: Mon, 24 Nov 2003 16:47:44 +0000 Subject: [PATCH] Free "engine" resource in case of failure to prevent memory leak PR: #778 Submitted by: George Mitchell --- crypto/engine/hw_cryptodev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crypto/engine/hw_cryptodev.c b/crypto/engine/hw_cryptodev.c index 40af97ac24..19b313ff81 100644 --- a/crypto/engine/hw_cryptodev.c +++ b/crypto/engine/hw_cryptodev.c @@ -1054,14 +1054,17 @@ ENGINE_load_cryptodev(void) if (engine == NULL) return; - if ((fd = get_dev_crypto()) < 0) + if ((fd = get_dev_crypto()) < 0) { + ENGINE_free(engine); return; + } /* * find out what asymmetric crypto algorithms we support */ if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { close(fd); + ENGINE_free(engine); return; } close(fd); -- 2.25.1