]> granicus.if.org Git - openssl/commitdiff
Free "engine" resource in case of failure to prevent memory leak
authorLutz Jänicke <jaenicke@openssl.org>
Mon, 24 Nov 2003 16:48:52 +0000 (16:48 +0000)
committerLutz Jänicke <jaenicke@openssl.org>
Mon, 24 Nov 2003 16:48:52 +0000 (16:48 +0000)
PR: #778
Submitted by: George Mitchell <george@m5p.com>

crypto/engine/eng_cryptodev.c

index e93b7fd1a23eb7d9fb232fdc1fdb6f2bd3d01805..f8a4a292b5b7e2436c455faf4263fde4845ad472 100644 (file)
@@ -1055,14 +1055,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);