From eedbb6bb8e640fe0e3d9afa91e874d544f9afa04 Mon Sep 17 00:00:00 2001 From: cuihongpeng Date: Thu, 23 Aug 2018 17:58:24 +0800 Subject: [PATCH] sm2: fix cv free error, in o2i_SM2CiphertextValue() function --- crypto/sm2/sm2_oct.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 crypto/sm2/sm2_oct.c diff --git a/crypto/sm2/sm2_oct.c b/crypto/sm2/sm2_oct.c old mode 100644 new mode 100755 index 6f951e77..f9ca4cfb --- a/crypto/sm2/sm2_oct.c +++ b/crypto/sm2/sm2_oct.c @@ -274,7 +274,9 @@ SM2CiphertextValue *o2i_SM2CiphertextValue(const EC_GROUP *group, ret = cv; end: - SM2CiphertextValue_free(cv); + if ((cv != *pout) && (!ret)) + SM2CiphertextValue_free(cv); + EC_POINT_free(point); BN_CTX_free(bn_ctx); return ret;