Fix copy constructor
authorCryptoManiac <balthazar.ad@gmail.com>
Sat, 27 Nov 2021 12:01:57 +0000 (15:01 +0300)
committerCryptoManiac <balthazar.ad@gmail.com>
Sat, 27 Nov 2021 12:01:57 +0000 (15:01 +0300)
src/bignum.h

index f37d7ed..1c9d7fb 100644 (file)
@@ -70,8 +70,10 @@ public:
     CBigNum& operator=(const CBigNum& b)
     {
         bn = BN_new();
-        if (!BN_copy(bn, b.bn))
+        if (!BN_copy(bn, b.bn)) {
+            BN_clear_free(bn);
             throw bignum_error("CBigNum::operator= : BN_copy failed");
+        }
         return (*this);
     }