Fix copy constructor
[novacoin.git] / src / bignum.h
index f1ec8d4..1c9d7fb 100644 (file)
@@ -69,8 +69,11 @@ public:
 
     CBigNum& operator=(const CBigNum& b)
     {
-        if (!BN_copy(bn, b.bn))
+        bn = BN_new();
+        if (!BN_copy(bn, b.bn)) {
+            BN_clear_free(bn);
             throw bignum_error("CBigNum::operator= : BN_copy failed");
+        }
         return (*this);
     }