summaryrefslogtreecommitdiff
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 9e15f36..37a57ec 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, 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: $Format:%D$ */
+/* git commit: $Format:%H$ */
+/* commit time: $Format:%ai$ */