mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-07 08:56:17 +08:00
Fix unnecessary free in o2i_SM2CiphertextValue
The caller will crash when using the return value from o2i_SM2CiphertextValue. Because the returned pointer to SM2CiphertextValue has been free, regardless of success or failure in this method. When assign cv to ret, cv should be set NULL just like the behaviour in SM2_do_encrypt.
This commit is contained in:
@@ -272,6 +272,7 @@ SM2CiphertextValue *o2i_SM2CiphertextValue(const EC_GROUP *group,
|
||||
/* set result */
|
||||
*pin = p;
|
||||
ret = cv;
|
||||
cv = NULL;
|
||||
|
||||
end:
|
||||
if ((cv != *pout) && (!ret))
|
||||
|
||||
Reference in New Issue
Block a user