Print this page
9644 Double-free in crypto tests on failure
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Mike Zeller <mike.zeller@joyent.com>

@@ -9,10 +9,11 @@
  * http://www.illumos.org/license/CDDL.
  */
 
 /*
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2018, Joyent, Inc.
  */
 
 #include <fcntl.h>
 #include <strings.h>
 #include <unistd.h>

@@ -132,11 +133,10 @@
 
         if (kcf_do_ioctl(CRYPTO_GET_MECHANISM_NUMBER,
             (uint_t *)&get_number, "get_mech_info") != CRYPTO_SUCCESS) {
                 (void) fprintf(stderr, "failed to resolve mechanism name %s\n",
                     op->mechname);
-                (void) cryptotest_close(op);
                 return (CTEST_NAME_RESOLVE_FAILED);
         }
         op->mech = get_number.pn_internal_number;
         return (CRYPTO_SUCCESS);
 }

@@ -156,11 +156,10 @@
 
         if (rv != 0 || mech.rv != CRYPTO_SUCCESS) {
                 (void) fprintf(stderr,
                     "could not find provider for mechanism %llu\n",
                     mech.mech_type);
-                (void) cryptotest_close(op);
                 return (CTEST_MECH_NO_PROVIDER);
         }
 
         op->hsession = mech.session_id;