Fix coverity defect 53/215653/1 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/5.5/unified/20191031.021626 accepted/tizen/5.5/unified/mobile/hotfix/20201027.085807 accepted/tizen/unified/20191015.011936 submit/tizen/20191014.035353 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 tizen_5.5.m2_release
authorSangwan Kwon <sangwan.kwon@samsung.com>
Mon, 14 Oct 2019 02:35:35 +0000 (11:35 +0900)
committerSangwan Kwon <sangwan.kwon@samsung.com>
Mon, 14 Oct 2019 02:35:35 +0000 (11:35 +0900)
The returned chain persists after the ctx structure is freed,
when it is no longer needed it should be free up using.

Change-Id: I2b25f94d1c5492e304f6b5d82a072b0e80e40165
Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
src/curl/tpkp_curl.cpp

index 0d288483d300bdce57bbadf5790ecac183705e64..2e7dd0a2c48635f33b8ac577634ae5b53b68804c 100644 (file)
@@ -139,6 +139,8 @@ int tpkp_curl_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx)
                                TPKP::HashAlgo::DEFAULT,
                                getPubkeyHash(sk_X509_value(chain, i), TPKP::HashAlgo::DEFAULT));
 
+               sk_X509_pop_free(chain, X509_free);
+
                bool isMatched = ctx.checkPubkeyPins();
 
                /* update decision cache */