From: Jakub Jelen <[email protected]>

The Coverity run on the latest opencryptoki-3.5 release showed
a new potential memory leak in the icsf specific code, which can
be fixed with the attatched patch.

---
 usr/lib/pkcs11/icsf_stdll/icsf_specific.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/usr/lib/pkcs11/icsf_stdll/icsf_specific.c 
b/usr/lib/pkcs11/icsf_stdll/icsf_specific.c
index d71b19f..3106919 100644
--- a/usr/lib/pkcs11/icsf_stdll/icsf_specific.c
+++ b/usr/lib/pkcs11/icsf_stdll/icsf_specific.c
@@ -4663,6 +4663,7 @@ CK_RV icsftok_unwrap_key(SESSION *session, 
CK_MECHANISM_PTR mech,
                                         "(expected %lu)\n",
                                         (unsigned long) mech->ulParameterLen,
                                         (unsigned long) expected_block_size);
+                        free(key_mapping);
                         return CKR_MECHANISM_PARAM_INVALID;
                 }
                 break;
@@ -4670,12 +4671,14 @@ CK_RV icsftok_unwrap_key(SESSION *session, 
CK_MECHANISM_PTR mech,
                if (mech->ulParameterLen != 0){
                         TRACE_ERROR("%s\n",
                                ock_err(ERR_MECHANISM_PARAM_INVALID));
+                        free(key_mapping);
                         return CKR_MECHANISM_PARAM_INVALID;
                 }
                 break;
        default:
                TRACE_ERROR("icsf invalid %lu mechanism for key wrapping\n",
                        mech->mechanism);
+               free(key_mapping);
                return CKR_MECHANISM_INVALID;
        }
 
-- 
2.5.5


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to