зеркало из https://github.com/github/putty.git
testsc.c: fix further memory leaks.
These were spotted by Leak Sanitiser rather than Coverity: it reported them while I was checking the fixes for Coverity-spotted issues.
This commit is contained in:
Родитель
2b1e0a5e05
Коммит
5f35f5b4ac
14
testsc.c
14
testsc.c
|
@ -334,6 +334,7 @@ static void test_mp_get_nbits(void)
|
||||||
log_end();
|
log_end();
|
||||||
}
|
}
|
||||||
mp_free(prev);
|
mp_free(prev);
|
||||||
|
mp_free(z);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mp_from_decimal(void)
|
static void test_mp_from_decimal(void)
|
||||||
|
@ -386,6 +387,7 @@ static void test_mp_string_format(char *(*mp_format)(mp_int *x))
|
||||||
log_end();
|
log_end();
|
||||||
sfree(formatted);
|
sfree(formatted);
|
||||||
}
|
}
|
||||||
|
mp_free(z);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mp_get_decimal(void)
|
static void test_mp_get_decimal(void)
|
||||||
|
@ -589,6 +591,10 @@ static void test_mp_modarith(
|
||||||
|
|
||||||
mp_free(out);
|
mp_free(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mp_free(base);
|
||||||
|
mp_free(exponent);
|
||||||
|
mp_free(modulus);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mp_modadd(void)
|
static void test_mp_modadd(void)
|
||||||
|
@ -625,6 +631,8 @@ static void test_mp_invert_mod_2to(void)
|
||||||
|
|
||||||
mp_free(out);
|
mp_free(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mp_free(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mp_modsqrt(void)
|
static void test_mp_modsqrt(void)
|
||||||
|
@ -647,7 +655,8 @@ static void test_mp_modsqrt(void)
|
||||||
|
|
||||||
/* Do one initial call to cause the lazily initialised sub-context
|
/* Do one initial call to cause the lazily initialised sub-context
|
||||||
* to be set up. This will take a while, but it can't be helped. */
|
* to be set up. This will take a while, but it can't be helped. */
|
||||||
mp_modsqrt(sc, x, &success);
|
mp_int *unwanted = mp_modsqrt(sc, x, &success);
|
||||||
|
mp_free(unwanted);
|
||||||
|
|
||||||
for (size_t i = 0; i < looplimit(8); i++) {
|
for (size_t i = 0; i < looplimit(8); i++) {
|
||||||
mp_random_bits_into(x, bits - 1);
|
mp_random_bits_into(x, bits - 1);
|
||||||
|
@ -802,6 +811,7 @@ static void test_ecc_weierstrass_multiply(void)
|
||||||
}
|
}
|
||||||
ecc_weierstrass_point_free(a);
|
ecc_weierstrass_point_free(a);
|
||||||
ecc_weierstrass_curve_free(wc);
|
ecc_weierstrass_curve_free(wc);
|
||||||
|
mp_free(exponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_ecc_weierstrass_is_identity(void)
|
static void test_ecc_weierstrass_is_identity(void)
|
||||||
|
@ -1000,6 +1010,7 @@ static void test_ecc_montgomery_multiply(void)
|
||||||
}
|
}
|
||||||
ecc_montgomery_point_free(a);
|
ecc_montgomery_point_free(a);
|
||||||
ecc_montgomery_curve_free(wc);
|
ecc_montgomery_curve_free(wc);
|
||||||
|
mp_free(exponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_ecc_montgomery_get_affine(void)
|
static void test_ecc_montgomery_get_affine(void)
|
||||||
|
@ -1132,6 +1143,7 @@ static void test_ecc_edwards_multiply(void)
|
||||||
}
|
}
|
||||||
ecc_edwards_point_free(a);
|
ecc_edwards_point_free(a);
|
||||||
ecc_edwards_curve_free(ec);
|
ecc_edwards_curve_free(ec);
|
||||||
|
mp_free(exponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_ecc_edwards_eq(void)
|
static void test_ecc_edwards_eq(void)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче