diff options
author | Daniel Larimer <dlarimer@gmail.com> | 2013-05-19 15:46:11 -0400 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-12-05 09:15:41 +0100 |
commit | 6f21e7317e86cac4f26234116513fa153111032a (patch) | |
tree | 547a648ece895bb6d5342e2c01e8a8b474e8ae5b /src | |
parent | daf9e4627f5dda2b7afec25bd17f6b75d803269a (diff) |
Fix memory leak on exception in Key::SignCompact
Diffstat (limited to 'src')
-rw-r--r-- | src/key.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/key.cpp b/src/key.cpp index 20114e6bb2..af9ffaf792 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -328,7 +328,10 @@ bool CKey::SignCompact(uint256 hash, std::vector<unsigned char>& vchSig) } if (nRecId == -1) + { + ECDSA_SIG_free(sig); throw key_error("CKey::SignCompact() : unable to construct recoverable key"); + } vchSig[0] = nRecId+27+(fCompressedPubKey ? 4 : 0); BN_bn2bin(sig->r,&vchSig[33-(nBitsR+7)/8]); |