Skip to content

Commit 4af447d

Browse files
ycaibbjforissier
authored andcommitted
core: ltc: fix missing mutex unlock
Fixes a missing mutex unlock on an out of memory error in ltc_ecc_fp_save_state(). Signed-off-by: Ryan Cai <ycaibb@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
1 parent c454414 commit 4af447d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/lib/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,8 +1436,10 @@ int ltc_ecc_fp_save_state(unsigned char **out, unsigned long *outlen)
14361436
* and the mu INTEGER
14371437
*/
14381438
cache_entry = XCALLOC(FP_ENTRIES*(2*(1U<<FP_LUT)+4)+3, sizeof(ltc_asn1_list));
1439-
if (cache_entry == NULL)
1440-
return CRYPT_MEM;
1439+
if (cache_entry == NULL) {
1440+
err = CRYPT_MEM;
1441+
goto save_err;
1442+
}
14411443
j = 1; /* handle the zero'th element later */
14421444

14431445
LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_SHORT_INTEGER, &fp_entries, 1);

0 commit comments

Comments
 (0)