Free "engine" resource in case of failure to prevent memory leak

PR: #778
Submitted by: George Mitchell <george@m5p.com>
This commit is contained in:
Lutz Jänicke 2003-11-24 16:47:44 +00:00
parent 28474e26f4
commit d161f5a9b2

View File

@ -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);