comparison ecc.c @ 1058:063c38ea622b

Fix some memory leaks in ecc code
author Matt Johnston <matt@ucc.asn.au>
date Sun, 01 Mar 2015 22:44:36 +0800
parents 30ab30e46452
children 750ec4ec4cbe
comparison
equal deleted inserted replaced
1053:fd3712d1ff7f 1058:063c38ea622b
84 for different mp_int pointer without LTC_SOURCE */ 84 for different mp_int pointer without LTC_SOURCE */
85 static int ecc_is_point(ecc_key *key) 85 static int ecc_is_point(ecc_key *key)
86 { 86 {
87 mp_int *prime, *b, *t1, *t2; 87 mp_int *prime, *b, *t1, *t2;
88 int err; 88 int err;
89
90 prime = m_malloc(sizeof(mp_int));
91 b = m_malloc(sizeof(mp_int));
92 t1 = m_malloc(sizeof(mp_int));
93 t2 = m_malloc(sizeof(mp_int));
94 89
95 m_mp_alloc_init_multi(&prime, &b, &t1, &t2, NULL); 90 m_mp_alloc_init_multi(&prime, &b, &t1, &t2, NULL);
96 91
97 /* load prime and b */ 92 /* load prime and b */
98 if ((err = mp_read_radix(prime, key->dp->prime, 16)) != CRYPT_OK) { goto error; } 93 if ((err = mp_read_radix(prime, key->dp->prime, 16)) != CRYPT_OK) { goto error; }