summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_init_copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/bn_mp_init_copy.c')
-rw-r--r--libtommath/bn_mp_init_copy.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c
index 33b0e82..88bb174 100644
--- a/libtommath/bn_mp_init_copy.c
+++ b/libtommath/bn_mp_init_copy.c
@@ -23,10 +23,15 @@ int mp_init_copy (mp_int * a, const 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
-/* $Source$ */
-/* $Revision$ */
-/* $Date$ */
+/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */
+/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */
+/* commit time: 2017-08-29 10:48:46 +0200 */