Fix crash
[novacoin.git] / src / bignum.h
index 3d5ec4b..3730b47 100644 (file)
@@ -78,6 +78,15 @@ public:
         return (*this);
     }
 
+    CBigNum(const BIGNUM *bnp) {
+        BIGNUM *dup = BN_dup(bnp);
+        if (!dup)
+        {
+            throw bignum_error("CBigNum::CBigNum(const BIGNUM*) : BN_dup failed");
+        }
+        bn = dup;
+    }
+
     ~CBigNum()
     {
         BN_clear_free(bn);