fix memory leak in mp_init_copy()

This closes #59
This commit is contained in:
Dmitry Kovalenko 2016-05-16 00:27:13 +02:00 committed by Steffen Jaeckel
parent 447f7b8148
commit 5f8fb25f64

View File

@ -23,7 +23,12 @@ int mp_init_copy (mp_int * a, mp_int * b)
if ((res = mp_init_size (a, b->used)) != MP_OKAY) {
return res;
}
return mp_copy (b, a);
if((res = mp_copy (b, a)) != MP_OKAY) {
mp_clear(a);
}
return res;
}
#endif