From: Lutz Jänicke Date: Mon, 24 Nov 2003 16:47:44 +0000 (+0000) Subject: Free "engine" resource in case of failure to prevent memory leak X-Git-Tag: OpenSSL_0_9_7d~77 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d161f5a9b26c751682dca4c4cc08fab6cf88ee1d;p=oweals%2Fopenssl.git Free "engine" resource in case of failure to prevent memory leak PR: #778 Submitted by: George Mitchell --- 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);