Fix Coverity issue 46/215646/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.024557 accepted/tizen/5.5/unified/mobile/hotfix/20201027.084441 accepted/tizen/5.5/unified/wearable/hotfix/20201027.115003 accepted/tizen/unified/20191015.011932 submit/tizen/20191014.021444 submit/tizen/20191014.152638 submit/tizen_5.5/20191031.000003 submit/tizen_5.5_mobile_hotfix/20201026.185103 submit/tizen_5.5_wearable_hotfix/20201026.184303 tizen_5.5.m2_release
authorJihoon Jung <jh8801.jung@samsung.com>
Mon, 14 Oct 2019 11:03:26 +0000 (20:03 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Mon, 14 Oct 2019 11:04:35 +0000 (20:04 +0900)
- Resource leak : 1088005, 1087972

Change-Id: I22859a80e5f8ff3ff6056df6738d180ab9fbfbf1
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
src/commonlib/net_nfc_util_openssl.c

index 3c89ab7..75aa972 100644 (file)
@@ -399,6 +399,9 @@ int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t * buffer, uint32_t l
        switch (type) {
        case 0:
                result = 0;
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L // OpenSSL 1.1.1
+                EVP_MD_CTX_free(ctx);
+#endif
                return result;
 
                /* RSASSA-PSS, RSASSA-PKCS1-v1_5 */
@@ -500,6 +503,9 @@ int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t * buffer, uint3
        switch (type) {
        case 0:
                result = 0;
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L // OpenSSL 1.1.1
+                EVP_MD_CTX_free(ctx);
+#endif
                return result;
 
                /* RSASSA-PSS, RSASSA-PKCS1-v1_5 */